Repository navigation
Conversation
ec383c2 to
843a4ab
Compare
843a4ab to
54c1ac4
Compare
) Replace nonisolated(unsafe) on non-Sendable CheckedContinuation properties with a thread-safe LockedValue wrapper using NSLock. This fixes Swift 6.3-dev build failures without bumping platform minimums (preserves macOS 13+/iOS 16+). Fixes modelcontextprotocol#211 Co-authored-by: Stijn Willems <[email protected]>
54c1ac4 to
70ea8de
Compare
|
Fixed in #203 and available in the latest v0.12 release. Please check. |
Issue titles are now bare 'Upstream PR#<n>'; the merge/investigate/decline label carries the decision, so the title does not duplicate it. Two places named the old convention and are updated. The investigate count was also stale: it said twelve, which was true at triage on 2026-09-10. Four were declined since (modelcontextprotocol#280, modelcontextprotocol#226, modelcontextprotocol#118, modelcontextprotocol#204) and two were promoted and merged (modelcontextprotocol#266 as entries 9/9a, modelcontextprotocol#275 as 10/10a/10b), leaving six — modelcontextprotocol#178, modelcontextprotocol#213, modelcontextprotocol#216, modelcontextprotocol#257, modelcontextprotocol#258, modelcontextprotocol#259 — now listed by number rather than by count, so the sentence cannot drift again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Eb9yGSXH1TVkg5Afsu9phk
|
Hi @doozMen, thank you for this contribution, and sorry it sat without a decision for so long. As noted above, this was fixed in #203 and shipped in v0.12. The diff no longer matches current We plan to close this PR in about a week. If you'd like to continue, please comment here (or open a fresh PR against current |
|
Hi @doozMen, thank you for this PR, and for the care you put into the continuation fix! We have just opened the Swift SDK 1.0.0 release (#372, branch What 1.0.0 does not cover yet: the If you are still interested, we would welcome a PR for that remaining piece, rebased onto Thank you again for contributing. We would love to see more from you on the new stack! |
Summary
Fixes #214 —
CheckedContinuationnever resumed inNetworkTransportsend()/sendHeartbeat()/receiveData()when the actor deallocates during an in-flight NWConnection operation. This causes a permanent deadlock.Discovered via Swift 6.3 strict concurrency checking, but the bug exists in all Swift versions using this transport.
Changes
NetworkTransport.swift
send(): Changed completion closure capture from[weak self]to[weak self, continuation]. Addedcontinuation.resume(throwing:)in theguard let self elsebranch.sendHeartbeat(): Same fix — completion closure now capturescontinuationdirectly and resumes with error on dealloc.receiveData(): Changed from implicit strongselfcapture to explicit[weak self, continuation]for consistency. All four branches already resumed the continuation; this hardens the capture semantics.Client.swift
withBatch(): Fixed early-return path to returnresultinstead of implicit void (was broken for non-VoidgenericT).ClientTests.swift
testBatchRequestEmptyNonVoid()— verifieswithBatchreturns the closure result when no requests are added (non-Void path).Housekeeping
.claude/settings.local.jsonand.swift-version.gitignoreThe Pattern
CheckedContinuationisSendable— safe to capture directly alongside[weak self]. This decouples the continuation's lifetime from the actor, guaranteeing resumption even on dealloc.Testing
swift build— cleanswift test --filter testBatchRequestEmpty— 2 tests passsendHeartbeat()— already correct in outer guard, fixed inner completionLoggerisnonisolated let+Sendable— safe to access from completion closures