Repository navigation
Wait for every held message before closing in the resume-order test - #102
Merged
Merged
Conversation
TransportTest.HeldBackConnectionsResumeInTheOrderTheyWereHeld raced the network thread in two places: - The first connection's close is raised outside the inbound ring's room, so it could reach core while later connections were still parked. The test then closed them and their messages never arrived. It now also waits until every expected message has been delivered. - wait_taken() shows that the kernel bytes were read, not that the push was refused. The last later message could therefore be pushed once core freed room, ahead of the parked ones. A probe connection that core closes after that message is taken now ends only after the network thread has pushed it. Under loaded TSan runs on macOS the test failed 26 times in 900 before this change and 0 times in 1800 after it.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The synchronization probe is declared const, but its completion handler later modifies non-mutable members, causing undefined behavior in the new synchronization path.
1 open issue
What changed in this PR
This test-only PR addresses two races in the transport resume-order test that caused intermittent failures during Linux ThreadSanitizer testing.
Changes:
- Adds a probe connection to synchronize the final held-message push before core drains the inbound ring.
- Waits for every expected message before closing the remaining connections.
- Checks probe completion and errors alongside the existing peers.
| File | Description |
|---|---|
tests/test_transport.cpp |
Strengthens synchronization and shutdown conditions in the held-message resume-order test. |
Review effort: Balanced
The peer's completion handler assigns its members after construction, which a const object does not allow.
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.

Summary
TransportTest.HeldBackConnectionsResumeInTheOrderTheyWereHeldwas flaky. It failed on the Linux TSan job of #100 withorderholding only the five "first" messages. The test raced the network thread in two places. This PR changes only the test.Change
wait_taken()shows the kernel bytes were read, not that the push was refused. The last later message could therefore be pushed once core freed room, ahead of the parked ones (ordershowed "later 8" before the first's held message). A probe connection that core closes after that message is taken now ends only after the network thread has pushed it. The test waits for that before core runs.Tests