Skip to content

trickle: Various fixes#3594

Merged
j0sh merged 20 commits intomasterfrom
ja/trickle-bugs
Jun 26, 2025
Merged

trickle: Various fixes#3594
j0sh merged 20 commits intomasterfrom
ja/trickle-bugs

Conversation

@j0sh
Copy link
Collaborator

@j0sh j0sh commented May 28, 2025

  • 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: close header to encourage client disconnects

  • Force close the connection under some circumstances

  • Specifically handle closed preconnects on the gotrickle client.

trickle: Add basic unit tests
Also run them in CI

j0sh added 3 commits May 28, 2025 05:09
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
@j0sh j0sh requested review from leszko, mjh1 and victorges May 28, 2025 05:30
@github-actions github-actions bot added the go Pull requests that update Go code label May 28, 2025
@codecov
Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 80.76923% with 20 lines in your changes missing coverage. Please review.

Project coverage is 31.71620%. Comparing base (ae88972) to head (75053c6).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
trickle/trickle_server.go 86.48649% 8 Missing and 2 partials ⚠️
trickle/trickle_subscriber.go 72.22222% 4 Missing and 1 partial ⚠️
trickle/local_subscriber.go 0.00000% 4 Missing ⚠️
trickle/trickle_publisher.go 87.50000% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 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     
Files with missing lines Coverage Δ
trickle/trickle_publisher.go 62.98077% <87.50000%> (+62.98077%) ⬆️
trickle/local_subscriber.go 0.00000% <0.00000%> (ø)
trickle/trickle_subscriber.go 68.87417% <72.22222%> (+68.87417%) ⬆️
trickle/trickle_server.go 67.35967% <86.48649%> (+67.35967%) ⬆️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae88972...75053c6. Read the comment docs.

Files with missing lines Coverage Δ
trickle/trickle_publisher.go 62.98077% <87.50000%> (+62.98077%) ⬆️
trickle/local_subscriber.go 0.00000% <0.00000%> (ø)
trickle/trickle_subscriber.go 68.87417% <72.22222%> (+68.87417%) ⬆️
trickle/trickle_server.go 67.35967% <86.48649%> (+67.35967%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j0sh j0sh enabled auto-merge (squash) June 10, 2025 19:21
@j0sh j0sh disabled auto-merge June 11, 2025 07:42
@j0sh
Copy link
Collaborator Author

j0sh commented Jun 26, 2025

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

@j0sh j0sh enabled auto-merge (squash) June 26, 2025 13:41
@j0sh j0sh merged commit 808f793 into master Jun 26, 2025
18 checks passed
@j0sh j0sh deleted the ja/trickle-bugs branch June 26, 2025 13:53
mjh1 added a commit that referenced this pull request Jun 30, 2025
mjh1 added a commit that referenced this pull request Jun 30, 2025
* Revert "ai/live: Don't suspend orchestrator if the client has not sent data. (#3642)"

This reverts commit c7747ed.

* Revert "trickle: Various fixes (#3594)"

This reverts commit 808f793.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants