Fix: Replace Mono.zip with Mono.when in StdioServerTransportProvider#sendMessage - #846
Open
rameshreddy-adutla wants to merge 1 commit into
Open
rameshreddy-adutla wants to merge 1 commit into
rameshreddy-adutla wants to merge 1 commit into
Conversation
1 of 2 tasks
Mono.zip cancels the slower Mono<Void> source when the faster one completes empty, so sendMessage could proceed before both inbound and outbound readiness signals fired. Mono.when waits for both. Fixes modelcontextprotocol#303.
rameshreddy-adutla
force-pushed
the
fix/303-mono-zip-to-when
branch
from
September 28, 2026 12:37
7f7e00e to
081605d
Compare
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.
Summary
Replaces
Mono.zip()withMono.when()inStdioMcpSessionTransport#sendMessageto correctly wait for both inbound and outbound ready signals before sending messages.Problem
Mono.zip()onMono<Void>sources cancels the slower publisher when the faster one completes empty. As explained by @chemicL, this means the slower of the two ready signals (inboundReadyoroutboundReady) gets cancelled instead of being awaited.Fix
Changed
Mono.zip(inboundReady.asMono(), outboundReady.asMono())toMono.when(inboundReady.asMono(), outboundReady.asMono())which properly waits for all sources to complete before proceeding.Testing
All 9 existing
StdioServerTransportProviderTestspass.Fixes #303