Skip to content

fix: contain chaff write failures during shutdown - #335

Open
ptgamr wants to merge 1 commit into
connectbot:mainfrom
ptgamr:fix/chaff-shutdown-failures
Open

ptgamr wants to merge 1 commit into
connectbot:mainfrom
ptgamr:fix/chaff-shutdown-failures

Conversation

@ptgamr

@ptgamr ptgamr commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Closing a PTY session while a keystroke-padding packet is in flight can let a TransportException escape the chaff coroutine and terminate the client process. We observed Android crashes with Connection closed: Socket closed and Packet writer stopped during tab shutdown. An admitted write can report a transport failure even after its coroutine has been cancelled.

Route these failures through the existing transportFailed path, consistent with the delivery workers fixed in #314. This closes unexpected failures normally and ignores connections already shutting down. Preserve ordinary CancellationException propagation and keep keystroke padding enabled.

Adds three deterministic regressions covering a failed chaff write, a write that fails after cancellation, and normal cancellation. The first two fail without the fix.

Validation: all 86 tests across KeystrokeObfuscationTest, SessionChannelTest, ForwardingChannelTest, ConnectionBackpressureTest, and PacketWriterTest pass. spotlessCheck and :sshlib:metalavaCheckCompatibility also pass.

This branch has not been deployed

No deployments
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.

1 participant