Conversation
propagate exception flag through read() and readAndUnwrap()
`read==0` guard only called waitSelect when `status==BUFFER_UNDERFLOW` after `readAndUnwrap` processes a TLS 1.3 NewSessionTicket (status=OK, zero app bytes, no buffered network data), the guard was skipped causing an unnecessary extra loop through `readAndUnwrap` before `BUFFER_UNDERFLOW` was reached on the second pass
Cover normal (non-error) data flow through the code paths changed by the read_nonblock exception fix and the netReadData.position() guard: - Multi-chunk read_nonblock: 30KB echo in 1KB chunks (TLS 1.3 + 1.2) - Multi-chunk with exception:false (TLS 1.3) - Partial read_nonblock: read 5 bytes then remainder from appReadData - Multiple puts/gets cycles: 10 rounds on a single connection - sysread/syswrite round-trip: 3 blocking cycles with exact byte counts - Large server write: server sends 48KB, client reads in 4KB chunks; regression test for netReadData.position()==0 guard (TLS 1.3 + 1.2)
write() unconditionally called netWriteData.clear() after a non-blocking flushData() that may not have flushed all encrypted bytes. This discarded unflushed TLS records, corrupting the encrypted stream and causing 'Broken pipe' or 'Connection reset' errors on subsequent writes — most commonly seen during 'gem push' of large gems over HTTPS. Fix: replace clear() with compact() which preserves unflushed bytes by moving them to the front of the buffer before engine.wrap() appends new encrypted output. Additionally, sysreadImpl() now flushes pending netWriteData before reading. After write_nonblock, encrypted bytes could remain unsent; without flushing first the server would never receive the complete request body (e.g. net/http POST), causing it to time out or reset.
This was
linked to
issues
Mar 26, 2026
This was referenced Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.