Repository navigation
net/stream: time the redial test against its own clock - #423
Merged
Merged
Conversation
a_peer_that_hangs_up_is_redialled_at_the_retry_rate counted accepts in a fixed one-second wall-clock window and asserted 5 to 15 of them. When the host was loaded the backend thread could be descheduled for part of that window, so it dialled fewer times than the interval allows and the test failed with "3 connections in one second". Wait for six accepts instead and check the time between the first and the last. The backend can be late but cannot dial sooner than one retry after the previous dial, so the span has a floor that load does not move. The only slack needed is for the first accept being noticed late, which the test allows one whole interval. A client that redials without waiting makes the six in a few milliseconds and fails. Checked by dropping the wait after a hung-up session: the test fails with six connections in 49ms. 200 sequential runs of the fixed test pass.
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.
a_peer_that_hangs_up_is_redialled_at_the_retry_ratechecks that a peer that accepts and hangs up is redialled once per retry interval, not in a tight loop.It counted accepts in a fixed one-second window and wanted 5 to 15. On a loaded host the backend thread can sit descheduled for part of that window, so it dialled fewer times and the test failed once with "3 connections in one second". It passes alone.
The test now waits for six accepts and checks the time between the first and the last. The backend can be late but can't dial sooner than one retry after the previous dial, so that span has a floor load doesn't move. The only slack needed is for the first accept being noticed late, and the test allows it one interval. Test only, no change to the backend.
It still catches a broken delay: removing the wait after a hung-up session fails it with "6 connections in 49ms, expected at least 400ms".
200 sequential runs of the fixed test: 200 passes.