| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
StdioServerTransportProvider.sendMessage waited on inbound/outbound readiness with Mono.zip. Both inboundReady and outboundReady are Sinks.One<Void> that complete empty (tryEmitValue(null)), and Mono.zip requires every source to emit a value: when one source completes empty it short-circuits and cancels the others. As a result sendMessage could proceed before both streams were actually ready instead of waiting for both. Mono.when subscribes to all sources and completes only once all of them complete, which is the correct combinator for completion-only (Mono<Void>) signals. Fixes modelcontextprotocol#303
|
Closing — already fixed by another contributor. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes #303.
StdioServerTransportProvider.sendMessage waited for the inbound and outbound streams to be ready using Mono.zip:
Both inboundReady and outboundReady are Sinks.One<Void> that complete empty (tryEmitValue(null)). Mono.zip requires every source to emit a value, and when one source completes without a value it short-circuits and cancels the remaining sources — exactly the behavior IntelliJ flagged in the issue. The consequence is that sendMessage could proceed as soon as the first readiness signal fired, cancelling the wait on the other, rather than waiting for both streams.
Mono.when is the correct combinator for completion-only (Mono<Void>) signals: it subscribes to all sources and completes only once all of them complete.
This matches the analysis and the reproduction in the issue.
Change
One-line operator swap: Mono.zip → Mono.when.
Testing