ok so mcp sdk has zero backpressure handling and tools just queue infinitely
hit this in prod yesterday running mcp sdk 0.5.0 with document processing tools. workflow fires 40 tool calls in parallel, sdk queues all 40 with no backpressure, memory usage spikes to 8.2gb, three tools timeout, llm retries with identical params, queue grows to 73 pending calls. built a wrapper that limits concurrent execution to 8 tools max with a semaphore. memory usage stays under 2gb, timeout rate drops from 18% to 3%, but overall workflow latency increases by ~40%. seems like the sdk should have built-in concurrency limits instead of accepting unbounded parallelism. anyone else hitting this or did we just configure something wrong
ok so i've been hitting this exact thing on 0.4.2 with file processing tools. queue just grows infinitely until memory explodes, no backpressure at all. did you try wrapping in semaphore to limit concurrent executions or does that break other stuff
yeah we hit this on 0.4.2 with batch csv processing tools. queue grows until oom, zero backpressure. wrapped it in asyncio.Semaphore(max_concurrent=8) which limits parallelism but at least it doesn't explode. the real fix is sdk needs built-in backpressure but that's probably six months out