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 transport: a request over the maximum line length gets no answer #1395
Since #1049 (rmcp 3.6.0) AsyncRwTransport drops a line that is longer than the maximum line length (16 MiB by default). It only writes a log entry. When that line is a request, the peer never gets an answer and waits until its own timeout. From the client side this looks like a server that hangs.
I found this while writing an MCP server that takes large inline files. A tools/call with a large base64 file in the arguments is enough.
To reproduce:
Start any stdio server built on rmcp 3.7.0.
Send initialize and notifications/initialized.
Send one tools/call request whose line is larger than 16 MiB, for example with a 17 MiB string in arguments.
The server logs "Incoming message exceeded the maximum line length, discarding it". The client gets nothing for this id.
Expected: an error answer for the request id, like the -32600 Invalid Request answer rmcp already sends for valid JSON with the wrong shape.
Lines without an id, responses and input that is not JSON should stay unanswered, so this does not bring back the error storm from #938.
I have a fix ready that builds on #1370. I can open it after that PR is merged.
@jordiboehme I looked at this after #1370 merged (28 Oct) and didn't find a follow-up PR. If you still have the patch, I'd rather review it and help with tests than open a competing one.
I didn't run a 17 MiB stdio session, but the current code matches the report. In AsyncRwTransport::receive (crates/rmcp/src/transport/async_rw.rs:283-289), LineRead::Oversized only logs Incoming message exceeded the maximum line length, discarding it and continues. The line is never parsed, so nothing is queued on pending_error_response and the peer gets no reply for that id. Transport::receive has no error channel, so the service loop never sees the dropped request either.
crates/rmcp/tests/test_async_rw_max_line_length.rs already covers drop, recovery, and the default 16 MiB bound, but the test helper builds the transport with tokio::io::sink(), so those tests don't assert what the client would read.
Repro is the one in the issue: start a stdio server on current main, send initialize and notifications/initialized, then one single-line tools/call whose frame is just over 16 MiB (for example a ~17 MiB string in arguments). The server logs the discard line; nothing comes back for that request id.
If we can recover the id from a prefix of the discarded line, the reply I'd expect is the same -32600 the wrong-shape path already sends, but with that id:
If the id isn't in the prefix — or the line is a response, a notification, or not JSON — stay silent, same as #938. One open question: when a request-shaped line is oversized but the id can't be recovered, do you want that same id-less -32600 the current protocol-error path already writes ({"jsonrpc":"2.0","error":{"code":-32600,"message":"Invalid request"}}, id omitted), or silence?
Happy to help add tests that actually read the write side (id present, id after a large field, stay-silent cases) against whichever patch lands.
Activity
github-actions commentedon Oct 26, 2026
@gocamille is on triage rotation this week and is the reviewer for this one.
Codex labeled this bug / P1 (T-transport). Please confirm or correct those labels.
Automated triage. Labels are a first pass and the assigned maintainer has the final say.
sai-softwareforest commentedon Nov 12, 2026
@jordiboehme I looked at this after #1370 merged (28 Oct) and didn't find a follow-up PR. If you still have the patch, I'd rather review it and help with tests than open a competing one.
I didn't run a 17 MiB stdio session, but the current code matches the report. In
AsyncRwTransport::receive(crates/rmcp/src/transport/async_rw.rs:283-289),LineRead::Oversizedonly logsIncoming message exceeded the maximum line length, discarding itandcontinues. The line is never parsed, so nothing is queued onpending_error_responseand the peer gets no reply for that id.Transport::receivehas no error channel, so the service loop never sees the dropped request either.crates/rmcp/tests/test_async_rw_max_line_length.rsalready covers drop, recovery, and the default 16 MiB bound, but the test helper builds the transport withtokio::io::sink(), so those tests don't assert what the client would read.Repro is the one in the issue: start a stdio server on current main, send
initializeandnotifications/initialized, then one single-linetools/callwhose frame is just over 16 MiB (for example a ~17 MiB string inarguments). The server logs the discard line; nothing comes back for that request id.If we can recover the id from a prefix of the discarded line, the reply I'd expect is the same
-32600the wrong-shape path already sends, but with that id:{"jsonrpc":"2.0","id":,"error":{"code":-32600,"message":"Invalid request"}}
If the id isn't in the prefix — or the line is a response, a notification, or not JSON — stay silent, same as #938. One open question: when a request-shaped line is oversized but the id can't be recovered, do you want that same id-less
-32600the current protocol-error path already writes ({"jsonrpc":"2.0","error":{"code":-32600,"message":"Invalid request"}}, id omitted), or silence?Happy to help add tests that actually read the write side (id present, id after a large field, stay-silent cases) against whichever patch lands.