Commit 60ae5fb
committed
fix: propagate SSE stream errors to messageEndpointSink
When the SSE stream encounters an error before the endpoint event is
received, the messageEndpointSink is never signaled. This causes
sendMessage() to hang indefinitely since Sinks.One.asMono() has no
built-in timeout.
This commit propagates errors to messageEndpointSink in two places:
1. onErrorComplete handler: propagates the actual error
2. doFinally handler: emits CancellationException as a safety net for
cases where the stream completes without going through onErrorComplete
Since Sinks.One only accepts a single emission, duplicate calls to
tryEmitError() are safely ignored when the sink has already been
completed (either with a value or an error).
Closes #323
Signed-off-by: gyeo009 <gyeo009@users.noreply.github.com>1 parent 8549e36 commit 60ae5fb
File tree
2 files changed
+26
-0
lines changed- mcp-core/src/main/java/io/modelcontextprotocol/client/transport
- mcp-test/src/test/java/io/modelcontextprotocol/client/transport
2 files changed
+26
-0
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
399 | 400 | | |
400 | 401 | | |
401 | 402 | | |
| 403 | + | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
405 | 410 | | |
406 | 411 | | |
407 | 412 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
247 | 268 | | |
248 | 269 | | |
249 | 270 | | |
| |||
0 commit comments