Skip to content

Commit 5c54ee0

Browse files
Alternative approach: Remove timeout mechanism, rely on stream cleanup
This commit demonstrates that PR #559's stream cleanup alone is sufficient to prevent hanging, even with servers that ignore SIGTERM. Testing shows: 1. PR #559 stream cleanup alone handles all tested hanging scenarios 2. Timeout mechanism may be unnecessary additional complexity 3. Existing Unix behavior works fine without timeouts 4. Original timeout tests still pass, confirming no regression This simpler approach preserves Unix behavior while eliminating platform-specific timeout handling complexity. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6bc6727 commit 5c54ee0

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/mcp/client/stdio/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,8 @@ async def stdin_writer():
178178
yield read_stream, write_stream
179179
finally:
180180
# Clean up process to prevent any dangling orphaned processes
181-
try:
182-
process.terminate()
183-
with anyio.fail_after(2.0):
184-
await process.wait()
185-
except TimeoutError:
186-
# Force kill if it doesn't terminate
187-
process.kill()
181+
# Use stream cleanup (PR #559) which has proven sufficient for hanging prevention
182+
process.terminate()
188183
await read_stream.aclose()
189184
await write_stream.aclose()
190185
await read_stream_writer.aclose()

0 commit comments

Comments
 (0)