Skip to content

Rewrite of the reconnection logic - #147

Closed
nighthawk wants to merge 1 commit into
modelcontextprotocol:mainfrom
nighthawk:main
Closed

nighthawk wants to merge 1 commit into
modelcontextprotocol:mainfrom
nighthawk:main

Conversation

@nighthawk

@nighthawk nighthawk commented Jul 14, 2025 •

Copy link
Copy Markdown

Motivation and Context

This is a rewrite of the reconnection logic as that currently leads to occasional crashes, due to the continuation being resumed multiple times, see #137.

How Has This Been Tested?

I've tested this in a real application, connecting and re-connecting both via Claude Desktop and Companion. While I haven't found a reliable way to reproduce the crashes, I haven't encountered them anymore in my testing so far.

Breaking Changes

None. Only internals are touched.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

I've tried to maintain the logging and overall logic as before, even though the code has shifted around a fair bit. The CheckedContinuation is no longer passed around.

Closes #137

Avoid duplicate calls to resuming continuation
@nighthawk

Copy link
Copy Markdown
Author

Closing for now. Just got a suspicious crash while testing this, that I want to investigate first in case it's related:

_Concurrency/CheckedContinuation.swift:196: Fatal error: SWIFT TASK CONTINUATION MISUSE: start(log:) tried to resume its continuation more than once, throwing CancellationError()!

@nighthawk nighthawk closed this Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash in NetworkTransport on reconnect

1 participant