Repository navigation
Close MCP stderr readers on client teardown - #43870
Merged
copyberry[bot] merged 1 commit intoSep 8, 2026
Merged
copyberry[bot] merged 1 commit into
copyberry[bot] merged 1 commit into
Conversation
## Why A descendant outside an MCP server's process group can keep stderr open after the server exits, leaving the reader task and its file descriptor alive. ## What changed Signal the local stderr reader during explicit shutdown and when the process handle is dropped. Allow up to 250 ms to drain queued diagnostics before closing the reader, even if stderr never reaches EOF. ## Testing Add a Unix regression test covering explicit shutdown and client drop with a descendant that keeps stderr open. Verify that file descriptor counts return to baseline while the descendant remains alive and that queued diagnostics are logged. GitOrigin-RevId: 1b544e8dba2b5616db6739d075e7232564c92884
copyberry
Bot
force-pushed
the
copyberry/codex-internal-to-codex-oss/1b544e8dba2b5616db6739d075e7232564c92884
branch
from
September 8, 2026 17:43
5801402 to
44ab726
Compare
copyberry
Bot
deleted the
copyberry/codex-internal-to-codex-oss/1b544e8dba2b5616db6739d075e7232564c92884
branch
September 8, 2026 17:44
thecosmicskye
temporarily deployed
to
issue-triage
September 8, 2026 17:48 — with
GitHub Actions
Inactive
thecosmicskye
temporarily deployed
to
issue-triage
September 8, 2026 17:48 — with
GitHub Actions
Inactive
thecosmicskye
temporarily deployed
to
issue-triage
September 8, 2026 17:48 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close MCP stderr readers on client teardown
Why
A descendant outside an MCP server's process group can keep stderr open after the server exits, leaving the reader task and its file descriptor alive.
What changed
Signal the local stderr reader during explicit shutdown and when the process handle is dropped. Allow up to 250 ms to drain queued diagnostics before closing the reader, even if stderr never reaches EOF.
Testing
Add a Unix regression test covering explicit shutdown and client drop with a descendant that keeps stderr open. Verify that file descriptor counts return to baseline while the descendant remains alive and that queued diagnostics are logged.