You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stdio server stops answering queued requests under CPU contention until more input arrives (lost wakeup?) #3964
Versions: mcp 1.30.0, anyio 4.16.0, CPython 3.14.7, Linux x86_64.
What happens. A FastMCP stdio server, given several requests in one write, sometimes answers the first few and
then stops: the remaining requests (and a final ping) get no response, with stdin still open, for as long as we
waited (90 s). It happens only under CPU contention. Alone it answered every time (0 of 10 runs stalled). With eight
copies running at once on four cores, 6 of 48 runs stalled. The point where it stops varies between runs: the
missing ids were {6, 7, 999}, {7, 999} or {999}.
Driver. One write to stdin of these lines, then wait (stdin left open) for responses to ids 3, 4, 6, 7 and 999: initialize (id 1); notifications/initialized; a malformed line ({not json ...); a request with an unknown
method (id 2); tools/call of an unknown tool (id 3); tools/call of recall with an unknown argument (id 4); a tools/call whose params is a string (id 5); a batch array; prompts/get of an unknown prompt (id 6); resources/read of an unknown URI (id 7); ping (id 999).
Stack dump of a stalled server (faulthandler, SIGABRT after 30 s without a response): the main thread is idle in
the asyncio loop's select (epoll_wait), and the AnyIO worker threads are idle in queue.get. No request handler
is running, and nothing is blocked. That looks like a result handed back to the loop without the loop being woken: a further message sent after the stall gets the outstanding responses answered: a driver that sends an extra ping after 5 s of silence saw 3 of 40 runs stall under the same load, and all 3 completed after the ping.
Expected: every request read from stdin is eventually answered while stdin is open, whatever the CPU load.
Happy to provide the full driver script and dumps.
Activity