Skip to content

fix(channels): preserve unread data on remote close - #257

Merged
kruton merged 1 commit into
connectbot:mainfrom
kruton:fix-245
Aug 5, 2026
Merged

fix(channels): preserve unread data on remote close#257
kruton merged 1 commit into
connectbot:mainfrom
kruton:fix-245

Conversation

@kruton

@kruton kruton commented Aug 5, 2026

Copy link
Copy Markdown
Member

CHANNEL_CLOSE can arrive while a delivery pump is suspended on a "rendezvous" send or while ingress data remains queued. Cancelling the pump then drops stdout, stderr, extended-data, or forwarding tails (depending on the channel type) and reports a misleading clean EOF.

Gracefully drain accepted data after remote closure while keeping caller-requested close and disconnect as an abort. Explicit close also releases pumps retained after remote closure, delayed delivery no longer returns stale window credit, and the state-machine model checks valid inbound-stream closure effects.

Add unit and FakeServer coverage for delayed session and forwarding reads, explicit aborts, direct TCP forwarding, and a deterministic 1 MiB multi-window transfer whose final packet remains parked until CLOSE is processed. This should exercise the issues that were being seen without relying on probabalistic tests.

Fixes #245

CHANNEL_CLOSE can arrive while a delivery pump is suspended on a
"rendezvous" send or while ingress data remains queued. Cancelling the
pump then drops stdout, stderr, extended-data, or forwarding tails
(depending on the channel type) and reports a misleading clean EOF.

Gracefully drain accepted data after remote closure while keeping
caller-requested close and disconnect as an abort. Explicit close also
releases pumps retained after remote closure, delayed delivery no longer
returns stale window credit, and the state-machine model checks valid
inbound-stream closure effects.

Add unit and FakeServer coverage for delayed session and forwarding
reads, explicit aborts, direct TCP forwarding, and a deterministic 1 MiB
multi-window transfer whose final packet remains parked until CLOSE is
processed. This should exercise the issues that were being seen without
relying on probabalistic tests.

Fixes connectbot#245
@kruton
kruton merged commit 762e014 into connectbot:main Aug 5, 2026
11 checks passed
@kruton
kruton deleted the fix-245 branch August 5, 2026 21:38
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.

SessionChannel drops buffered output when CHANNEL_CLOSE arrives before the consumer receives it (delivery job cancelled mid-send)

1 participant