You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CheckedContinuation never resumed in NetworkTransport send/receive on actor dealloc (Swift 6.3) #214
When NetworkTransport is deallocated while an async send(), sendHeartbeat(), or receiveData() operation is in-flight, the CheckedContinuation inside the NWConnection completion handler is never resumed — causing a permanent deadlock.
Root Cause
The .contentProcessed completion closures capture [weak self] but do not capture continuation directly. When self becomes nil in the completion handler, the guard let self else { return } exits without resuming the continuation.
This violates Swift's CheckedContinuation contract: a continuation must be resumed exactly once. Never resuming causes the caller to hang forever. In debug builds (Swift 6.3), this produces a runtime warning.
Fixed in PR #213. The fix captures continuation directly in all NWConnection completion closures via [weak self, continuation] capture list, and resumes with an error when self is nil. This guarantees the CheckedContinuation contract (exactly-once resumption) even when the actor deallocates during in-flight operations.
Activity
doozMen commentedon Mar 18, 2026
Fixed in PR #213. The fix captures
continuationdirectly in all NWConnection completion closures via[weak self, continuation]capture list, and resumes with an error whenselfis nil. This guarantees the CheckedContinuation contract (exactly-once resumption) even when the actor deallocates during in-flight operations.