Repository navigation
xtcp: fix the TestTCPDest_writeTimeout race (poll the drop, not the first write error) - #398
Merged
Merged
Conversation
…error The test polled destTCP/Write/error >= 1 and then read the dropped counter once. With attempts = 2 the first write error is counted when the 100 ms deadline fires (when the test's 20 ms poll also wakes), the second attempt fails at once on the closed pipe, and only then is the drop counted, so a poll landing between them failed the test: 3 of 20 runs on main, 17 of 300 with -race -cpu 1,2,8. It now polls the drop, the worker's last step, and then checks one write error per attempt. 300 of 300 with -race -cpu 1,2,8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 the
TestTCPDest_writeTimeoutflake on main (the one noted in #388).The race
The test waited for
destTCP/Write/error >= 1, then read thedroppedcounter once. Withattempts = 2:A poll landing between steps 1 and 3 failed the test: 3 of 20 runs on main, 17 of 300 with
-race -cpu 1,2,8.The fix
The test now waits for the drop, the worker's last step, and then checks one write error per attempt. Test-only change in
pkg/xtcp/destinations_tcp_test.go. Passed 300 of 300 runs with-race -cpu 1,2,8.Gates (at 43ed7dd, rebased on main 4a9a934)
go test ./...: 114 packages passgo test -race -count=20 -run TestTCPDest_writeTimeout ./pkg/xtcp/: pass🤖 Generated with Claude Code