Repository navigation
Conversation
## Motivation and Context When a `subscriptions/listen` stream's write fails, in notification delivery or in the acknowledgement write, `StreamableHTTPTransport` removes the stream's registry entry and closes the stream. The close ran whether or not the removal was this path's own: when the keepalive loop, a token expiry, or the transport teardown had removed the entry a moment earlier, that path closes the stream too, and the failed write closed it a second time. Every other removal path closes the stream only when it was the one to remove the entry. The two write failure paths now do the same, so a stream is closed exactly once, by the path that removed it. An acknowledgement skipped because the teardown marked the entry closed first went the same way, closing a stream the teardown closes itself; that close is gone too. ## How Has This Been Tested? A new test in `test/mcp/server/transports/streamable_http_transport_test.rb` fails a delivery write on a stream whose entry another path removed just before, and counts the stream's closes: the delivery closes it once against the previous library, and leaves it to the remover now. A second test has the teardown mark an entry closed while its acknowledgement waits on the write mutex, and counts one close instead of the two the previous library made. ## Breaking Changes None.
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
When a
subscriptions/listenstream's write fails, in notification delivery or in the acknowledgement write,StreamableHTTPTransportremoves the stream's registry entry and closes the stream. The close ran whether or not the removal was this path's own: when the keepalive loop, a token expiry, or the transport teardown had removed the entry a moment earlier, that path closes the stream too, and the failed write closed it a second time. Every other removal path closes the stream only when it was the one to remove the entry.The two write failure paths now do the same, so a stream is closed exactly once, by the path that removed it. An acknowledgement skipped because the teardown marked the entry closed first went the same way, closing a stream the teardown closes itself; that close is gone too.
How Has This Been Tested?
A new test in
test/mcp/server/transports/streamable_http_transport_test.rbfails a delivery write on a stream whose entry another path removed just before, and counts the stream's closes: the delivery closes it once against the previous library, and leaves it to the remover now. A second test has the teardown mark an entry closed while its acknowledgement waits on the write mutex, and counts one close instead of the two the previous library made.Breaking Changes
None.
Types of changes
Checklist