Skip to content

Restore stdio descriptor flags on disconnect - #297

Open
EhsanAzish80 wants to merge 1 commit into
modelcontextprotocol:mainfrom
EhsanAzish80:fix/restore-stdio-descriptor-flags
Open

EhsanAzish80 wants to merge 1 commit into
modelcontextprotocol:mainfrom
EhsanAzish80:fix/restore-stdio-descriptor-flags

Conversation

@EhsanAzish80

Copy link
Copy Markdown

Fixes #69. StdioTransport now restores the blocking mode it changed when it disconnects. It waits for reads and sends to finish first, and leaves already nonblocking or reused descriptors alone.

Tests: the regression failed before the fix, 11 stdio tests and all 556 Swift tests passed locally, and the backpressure test passed 10 runs locally.

@varun06

varun06 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Hi @EhsanAzish80, thanks for this PR! I've reviewed it and it looks good to merge.

Could you please rebase it onto the latest main? CI was broken on macOS runners for every PR (a toolchain/SDK mismatch, fixed in #306), so rebasing will pick up the fix and give us a green run. I'll review and merge once it's updated.

If you're no longer able to work on this, no problem: just let us know. If we don't hear back in about two weeks, we may carry the change forward in a new PR, with credit to you.

@EhsanAzish80
EhsanAzish80 force-pushed the fix/restore-stdio-descriptor-flags branch from f2d760c to a0ce641 Compare October 22, 2026 15:29
@EhsanAzish80
EhsanAzish80 force-pushed the fix/restore-stdio-descriptor-flags branch from a0ce641 to 3025e14 Compare October 22, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return file descriptor mode to original state wrt O_NONBLOCK

2 participants