Skip to content

Process-group cleanup for stdio MCP servers to prevent orphan process storms#10710

Merged
etraut-openai merged 4 commits intomainfrom
etraut/rmcp_term
Feb 7, 2026
Merged

Process-group cleanup for stdio MCP servers to prevent orphan process storms#10710
etraut-openai merged 4 commits intomainfrom
etraut/rmcp_term

Conversation

@etraut-openai
Copy link
Collaborator

@etraut-openai etraut-openai commented Feb 5, 2026

This PR changes stdio MCP child processes to run in their own process group

  • Add guarded teardown in codex-rmcp-client: send SIGTERM to the group first, then SIGKILL after a short grace period.
  • Add terminate_process_group helper in process_group.rs.
  • Add Unix regression test in process_group_cleanup.rs to verify wrapper + grandchild are reaped on client drop.

Addresses reported MCP process/thread storm: #10581

… storms

This PR changes stdio MCP child processes to run in their own process group (process_group(0) on Unix).
* Add guarded teardown in codex-rmcp-client: send SIGTERM to the group first, then SIGKILL after a short grace period.
* Add terminate_process_group helper in process_group.rs.
* Add Unix regression test in process_group_cleanup.rs to verify wrapper + grandchild are reaped on client drop.

Addresses reported MCP process/thread storm: #10581
@etraut-openai
Copy link
Collaborator Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a18cfcdb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@etraut-openai
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@NormanMises
Copy link

Wait for this to be merged😋

@etraut-openai etraut-openai merged commit 82c981c into main Feb 7, 2026
36 of 38 checks passed
@etraut-openai etraut-openai deleted the etraut/rmcp_term branch February 7, 2026 05:26
@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants