fix(lifecycle): bound the session-id probe and release its response body - #455
Open
aviseth wants to merge 1 commit into
Open
fix(lifecycle): bound the session-id probe and release its response body#455aviseth wants to merge 1 commit into
aviseth wants to merge 1 commit into
Conversation
The visible-ASCII session-id check sends a raw initialize POST outside the SDK transport, because the transport does not expose the MCP-Session-Id response header. That fetch carried no abort signal and its body was never read or cancelled. A server that accepts the connection and never responds hung the scenario here, before teardown, so the DELETE bound added in modelcontextprotocol#316 never came into play. And since the probe's `Accept` includes `text/event-stream`, a server answering with an open SSE stream left the body unconsumed and leaked the connection for the rest of the run. Bounding the probe at 5s matches the existing session-termination bound. modelcontextprotocol#427 is the structural fix for the hang class; this is still worth having for fast failure and for attributing the failure to this check rather than to whatever the runner-level timeout happens to interrupt. Fixes modelcontextprotocol#428
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #428.
The visible-ASCII session-id check sends its own initialize POST, outside the SDK transport, because the transport doesn't expose the
MCP-Session-Idheader. That fetch had no abort signal and nothing ever read or cancelled the body.So a server that accepts and never answers hung the scenario before teardown, which meant the DELETE bound from #316 never got a chance to run. And since the probe sends
Accept: application/json, text/event-stream, a server answering with an open stream left the body dangling for the rest of the run.5s to match
SESSION_TERMINATE_TIMEOUT_MS, plusresponse.body?.cancel()once the header has been read.Branched off main rather than stacking on the #427 branch, since you noted this is worth having on its own even after the runner-level bound lands. Two tests, both fail against the unmodified probe. Full suite passes.