Repository navigation
Conversation
`readbytes`, `writebytes`, `peekbuf` and `peekbytes` are `Ref`s on the stream, shared by every task using it, and read back after `@geterror` released `ssl.lock`. Another task's SSL call can overwrite the count in that gap: a writer reading back a smaller count than its own thinks its chunk was not written and submits most of it again, duplicating plaintext on the wire. Reads and peeks have the same hole. The counts are per call now. The fields stay on the struct, unused by this package, because code outside it reads `transport.readbytes[]`. Adds `ConcurrentWriters`: four writers with different chunk sizes, the server checks every writer's bytes arrived exactly once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
==========================================
+ Coverage 77.56% 78.96% +1.39%
==========================================
Files 2 2
Lines 1083 1193 +110
==========================================
+ Hits 840 942 +102
- Misses 243 251 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
krynju
marked this pull request as draft
October 16, 2026 10:16
krynju
marked this pull request as ready for review
October 16, 2026 10:58
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.
Split out of #73, as asked in the review there: an independent fix, against
main.Bug.
readbytes,writebytes,peekbufandpeekbytesareRefs on the stream, shared by every task using it, and read back after@geterrorhas releasedssl.lock. Another task's SSL call can overwrite the count in that gap. A writer that reads back a smaller count than its own thinks its chunk was not written and submits most of it again, duplicating plaintext on the wire; reads and peeks have the same hole. Onmainthe gap is the lock release just before the read-back, so it needs threads to hit; any change that moves the socket write out from under the lock (the #72 fix) widens it to every parked write.Fix. Each call allocates its own
Refs. The four fields stay on the struct, unused by this package, since code outside it readstransport.readbytes[].Test.
ConcurrentWriters: four writers with different chunk sizes on one stream, the server checks every writer's bytes arrived exactly once. It passes onmainon one thread, where the window cannot be hit, and guards the invariant from here on.The test file gains the same three helpers as #86 (self-signed server context, handshake loop, connected pair), in the same place, so whichever lands later only has to re-append its testset.
No version bump; the fixes can be released together.
🤖 Generated with Claude Code