Repository navigation
Conversation
…uests sent are answered (#1765) A clean end of input was a failure: it logged a warning and aborted the requests in flight, so a request piped into the server lost its answer. Now the connector waits for them within the request timeout, cancels the listen streams, and closes quietly. An I/O error still aborts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
jlouvel
left a comment
There was a problem hiding this comment.
Thanks for the fix. I traced the races you listed and the core design holds: a slot is released only after the frame is written and flushed (writeFrame joins the writer thread and StreamTransport.write flushes, and done runs after dispatch/refuse return), the reader is the only admitter so nothing is admitted after endOfInput starts (and the listen registration in inFlight happens synchronously on that reader), the two-semaphore sum read is safe because both terms only decrease after the end of input, and stop() or a concurrent fail() simply ends the wait (a write error during the wait keeps its own cause in getFailure). Requests refused while waiting still hold their slot until the refusal is written. The deadline arithmetic is overflow-safe (requestTimeout is validated through toNanos in the adapter). Remaining points: (1) deadline vs timed-out request and the log level at expiry, (2) a listen stream that is not in inFlight is never cancelled, (3) getFailure cannot tell a clean end from a fault, (4) the 2025-11-25 era has no test, (5) the tests do not assert the headline behavior (log level, failure) and use sleep-based negative checks. Review assisted by Claude Code.
… it from a fault (#1765) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
jlouvel
left a comment
There was a problem hiding this comment.
Round 2. The six round 1 fixes are right: the wait is the request timeout plus the grace, cancelListens walks the requests set, the clean end is an EOFException, the fields are volatile, and the new tests (legacy era, duplicate id, no frame after the ack) are meaningful, with no timing race that can fail them (the only timed waits are negative 300 ms polls and 10 s awaits against a 35 s deadline). One point on the log-handler test below.
Review assisted by Claude Code.
…g, with a control (#1765) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
|



Fixes #1765.
StdioServerHelpertreated a clean end of its input as a failure: it calledfail(new IOException("MCP STDIO input ended")), which logged aWARNINGwith a stack trace and aborted every request in flight. A request piped into the server, or a client that half-closes stdin after its last request, lost its answer.endOfInput(): it waits, up to the adapter's request timeout, for the requests that hold a pending slot (both eras) to finish and write their answers, cancels the 2026-07-28 listen streams, which never end by themselves, as anotifications/cancelledwould, and then closes. The wait stops at once if the connector is stopped or fails.FINE, andgetFailure()still reports it, so owners that monitor a subprocess keep seeing it. An I/O error on the input still fails, aborts what is in flight and logs aWARNING.McpModernStdioTestCasewith a gated tool: a request in flight at the end of the input is answered, and the connector closes after it (fails without the fix); a listen stream is cancelled at the end of the input; an input error still aborts what is in flight and gets no answer.changes.mdentry under "Bugs fixed".All 244 tests of
org.restlet.ext.mcppass andspotless:checkis clean.🤖 Generated with Claude Code