Merged
Conversation
We sometimes get bytes *and* an io.EOF from the same read call. Errors are checked first but this would cause us to drop any data. Check for the bytes first. The EOF can come on the next read call.
There are a few parts to this fix: * Uses a channel to signal any hanging connections on the server * Set `Connection: close` header to encourage client disconnects * Force close the connection under some circumstances
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3594 +/- ##
===================================================
+ Coverage 30.54979% 31.71620% +1.16641%
===================================================
Files 156 156
Lines 47182 47244 +62
===================================================
+ Hits 14414 14984 +570
+ Misses 31926 31378 -548
- Partials 842 882 +40
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
mjh1
approved these changes
Jun 10, 2025
This was still causing rare failures where the error channel would be read first (out of order) from the result channel.
leszko
approved these changes
Jun 25, 2025
Collaborator
Author
|
Added a couple more fixes and test cases - I'm going to merge this now before this PR gets even more unwieldy. Later fixes will have separate / smaller PRs |
mjh1
added a commit
that referenced
this pull request
Jun 30, 2025
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.
Fixes a bug that caused us to drop very small writes. Small miracle that we haven't been bitten by this yet.
After closing a trickle channel, do a better job of cleaning up pre-connected publisher segments in a couple places. In practice this was mostly harmless (connections would have eventually errored out after enough 100 Continues) but this made unit tests take longer than they should.
Add unit tests to verify all the above
We should also probably have more integration type tests to also exercise similar parts of the pytrickle clients but that can come later.
trickle: Don't drop small reads.
We sometimes get bytes and an io.EOF from the same read call.
Errors are checked first but this would cause us to drop any data.
Check for the bytes first. The EOF can come on the next read call.
trickle: Clean up preconnected publishers.
There are a few parts to this fix, mostly on the server:
Uses a channel to signal any pending connections
Set
Connection: closeheader to encourage client disconnectsForce close the connection under some circumstances
Specifically handle closed preconnects on the gotrickle client.
trickle: Add basic unit tests
Also run them in CI