Repository navigation
test(thread): stop real backoff wakeups racing the drainer test passes - #3379
Merged
stamp-build[bot] merged 1 commit intoOct 21, 2026
Merged
Conversation
Tests drive drain passes by hand with drainOnceForTests, but the helper left the real wakeup scheduler armed when a test did not pass a capture list. After a retryable failure (timeout, 5xx) the real wakeup launched a second pass on Dispatchers.Default that raced the test's own backoff pass, so the same row could be sent three times. This made timeoutExceptionIsClassifiedAndBackedOff fail now and then in CI. Always capture wakeups in the helper, and assert the timeout test arms one. Production is not affected: there every pass goes through the serial consumer loop. 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.
Summary
Fixes the flaky
ThreadPendingSendDrainerTest.timeoutExceptionIsClassifiedAndBackedOff(task #2 in #wg-mobile). It failed once in #3373's first CI run (expected [random-1, random-1]), and a rerun passed.Cause (test only): these tests drive drain passes by hand with
drainOnceForTests. When a test didn't pass awakeupscapture list, the helper left the real backoff scheduler armed. After a retryable failure (timeout, 5xx), that real wakeup launched a second drain pass onDispatchers.Default, and it raced the backoff pass the test runs itself. Both passes could send the row, sosend.randomIdsbecame[random-1, random-1, random-1].Production is not affected. In production every pass, including backoff wakeups, goes through the serial consumer loop (
trigger→consumeLoop), so two passes never run at once.Change:
wakeupsdefaults to a fresh list), so no unit test arms a real timer.0mswakeup, like the 429 retry test.Verification
ThreadPendingSendDrainerTestclass passed (14 tests,:shared:testDebugUnitTest). The loop was temporary and is not committed.🤖 Generated with Claude Code