Skip to content

fix: avoid dropped errors when transport is closed or uninitialized#995

Open
chemicL wants to merge 2 commits into
mainfrom
session-connect-and-close-issues
Open

fix: avoid dropped errors when transport is closed or uninitialized#995
chemicL wants to merge 2 commits into
mainfrom
session-connect-and-close-issues

Conversation

@chemicL
Copy link
Copy Markdown
Member

@chemicL chemicL commented Jun 3, 2026

Also avoid logging peer disconnect at warn level.

chemicL added 2 commits May 29, 2026 22:58
Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>
Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>
@chemicL chemicL added this to the 2.0.0-RC1 milestone Jun 3, 2026
@chemicL chemicL added the enhancement New feature or request label Jun 3, 2026
@Test
void testCloseInitialized() {
var transport = HttpClientStreamableHttpTransport.builder(host).build();
// transport.connect(Function.identity()).block();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we don't need to call "connect" anymore?
If we are not "connect"-ed, shouldn't sendMessage error rather than complete?

import io.modelcontextprotocol.spec.McpTransportSessionNotFoundException;
import io.modelcontextprotocol.spec.McpTransportStream;
import io.modelcontextprotocol.spec.ProtocolVersions;
import io.modelcontextprotocol.spec.*;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - we typically don't do star imports.

})
.retryWhen(authorizationErrorRetrySpec())
.flatMap(jsonrpcMessage -> this.handler.get().apply(Mono.just(jsonrpcMessage)))
.flatMap(jsonrpcMessage -> requestHandler.apply(Mono.just(jsonrpcMessage)))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this leak?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants