Skip to content

Commit ac44dff

Browse files
committed
cleanup: remove failed investigation artifacts and fix misleading comments
Removed test files that were artifacts of failed investigation attempts: - test_262_aggressive.py - test_262_minimal_reproduction.py - test_262_standalone_race.py - test_262_tool_call_hang.py - reproduce_262_standalone.py These files had misleading "REPRODUCED!" messages that would confuse future maintainers. They didn't actually reproduce any permanent hang. Updated reproduce_262.py to be honest about what it shows and doesn't show. Simplified debug delay comments in SDK code - removed claims about "reproducing" the race condition, now just says it's for investigation.
1 parent f47b366 commit ac44dff

File tree

8 files changed

+80
-4160
lines changed

8 files changed

+80
-4160
lines changed

reproduce_262.py

Lines changed: 74 additions & 188 deletions
Large diffs are not rendered by default.

src/mcp/client/stdio/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,9 @@ async def stdout_reader():
166166
async def stdin_writer():
167167
assert process.stdin, "Opened process is missing stdin"
168168

169-
# DEBUG: Inject delay to reproduce issue #262 race condition
170-
# This delays stdin_writer from entering its receive loop, widening
171-
# the race window where send_request() might be called before the
172-
# task is ready. Set MCP_DEBUG_RACE_DELAY_STDIO=<seconds> to enable.
173-
#
174-
# NOTE: Due to cooperative multitasking, this delay won't cause a
175-
# permanent hang - when send() blocks, the event loop will eventually
176-
# run this task. But it demonstrates the race window exists.
169+
# DEBUG: Delay for investigating issue #262.
170+
# Set MCP_DEBUG_RACE_DELAY_STDIO=<seconds> to add delay before
171+
# this task enters its receive loop.
177172
_race_delay = os.environ.get("MCP_DEBUG_RACE_DELAY_STDIO")
178173
if _race_delay:
179174
await anyio.sleep(float(_race_delay))

src/mcp/shared/session.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,9 @@ async def _send_response(self, request_id: RequestId, response: SendResultT | Er
349349
await self._write_stream.send(session_message)
350350

351351
async def _receive_loop(self) -> None:
352-
# DEBUG: Inject delay to reproduce issue #262 race condition
353-
# This delays _receive_loop from entering its receive loop, widening
354-
# the race window. Set MCP_DEBUG_RACE_DELAY_SESSION=<seconds> to enable.
355-
#
356-
# NOTE: Due to cooperative multitasking, this delay won't cause a
357-
# permanent hang - it just demonstrates the race window exists.
352+
# DEBUG: Delay for investigating issue #262.
353+
# Set MCP_DEBUG_RACE_DELAY_SESSION=<seconds> to add delay before
354+
# this task enters its receive loop.
358355
import os
359356

360357
_race_delay = os.environ.get("MCP_DEBUG_RACE_DELAY_SESSION")

tests/issues/reproduce_262_standalone.py

Lines changed: 0 additions & 266 deletions
This file was deleted.

0 commit comments

Comments
 (0)