Repository navigation
Conversation
## Motivation and Context `StreamableHTTPTransport` closes every stream outside its registry lock, so a close that blocks on the peer cannot hold every other session on `@mutex`. One path broke that rule: when a `GET` stream could not be registered, because the session had gone or another stream had taken its place, `store_stream_for_session` closed the refused stream inside the lock, and an error raised by that close escaped the Rack body. The refused stream is now closed after the lock is released and through `close_stream_safely`, like the streams the transport drops everywhere else. ## How Has This Been Tested? Three new tests in `test/mcp/server/transports/streamable_http_transport_test.rb`: two refuse a second stream for a session, one checking from inside the stream's `close` that the lock is free, the other that a `close` raising `IOError` is swallowed and the session keeps serving, and the third refuses a stream for a session that is gone, checking the lock the same way. Against the previous library, the first and the third find the lock held and the second raises. ## Breaking Changes None.
atesgoral
approved these changes
Oct 9, 2026
This branch has not been deployed
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.
Motivation and Context
StreamableHTTPTransportcloses every stream outside its registry lock, so a close that blocks on the peer cannot hold every other session on@mutex. One path broke that rule: when aGETstream could not be registered, because the session had gone or another stream had taken its place,store_stream_for_sessionclosed the refused stream inside the lock, and an error raised by that close escaped the Rack body.The refused stream is now closed after the lock is released and through
close_stream_safely, like the streams the transport drops everywhere else.How Has This Been Tested?
Three new tests in
test/mcp/server/transports/streamable_http_transport_test.rb: two refuse a second stream for a session, one checking from inside the stream'sclosethat the lock is free, the other that acloseraisingIOErroris swallowed and the session keeps serving, and the third refuses a stream for a session that is gone, checking the lock the same way. Against the previous library, the first and the third find the lock held and the second raises.Breaking Changes
None.
Types of changes
Checklist