p2p: fix flaky TestWithReceiveTimeout on QUIC#4606
Merged
Conversation
The zero receive timeout makes the server close the stream almost immediately, racing the client's request write. On TCP the close is a graceful FIN, so the write always lands and the failure surfaces as an EOF on the response read. QUIC instead resets the stream, which can abort the write already in flight, failing with "write request: stream reset (remote)" before the read is ever reached. Accept either error on the QUIC iteration. The TCP iteration stays strict. category: test ticket: none Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4606 +/- ##
==========================================
- Coverage 57.58% 57.55% -0.03%
==========================================
Files 246 246
Lines 33675 33675
==========================================
- Hits 19392 19383 -9
- Misses 11845 11850 +5
- Partials 2438 2442 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
KaloyanTanev
approved these changes
Jul 27, 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.



TestWithReceiveTimeoutfails intermittently in CI on the QUIC iteration:The test registers the server handler with
WithReceiveTimeout(0), so the read deadline inp2p/receive.gois already expired when the handler starts.ReadMsgfails instantly and the deferreds.Close()tears the stream down — the CI log shows this happening 101µs in. Meanwhile the client is still inWriteMsg. Nothing synchronises the two, so which call reports the failure depends on who wins the race.The transport decides the usual winner. The test loops over both:
Close()is a graceful FIN. The in-flight write is absorbed by the buffer and succeeds, so the failure surfaces at the read as EOF. Deterministic.Close()with unread incoming data emitsSTOP_SENDING/RESET_STREAM. If that lands mid-write,WriteMsgfails first and the read is never reached.The assertion only allowed the first outcome, so a loaded runner could flip it. This is the same class of QUIC behaviour
sender.goalready tolerates viaisCanceledStreamErr, whose comment notes these errors appear "much more frequently when QUIC is enabled" — that handling just does not extend toWriteMsg.This accepts either terminal error on the QUIC iteration. The TCP iteration stays strict, since it has no race, and an unrelated error still fails on both.
category: test
ticket: none