Skip to content

Fix two races in queues-test - #8585

Merged
littledivy merged 2 commits into
mainfrom
littledivy/2026-11-18-ci-main-flakes
Nov 18, 2026
Merged

littledivy merged 2 commits into
mainfrom
littledivy/2026-11-18-ci-main-flakes

Conversation

@littledivy

Copy link
Copy Markdown
Member

queues-test failed on the Windows runners in two ways, both from the test itself. In evictionWaitsForDelivery, the consumer calls add() and then hold() on the Seen object as two separate calls. The test waits for the add() and calls release(), which can get there before hold() does, and it failed with "this[#held] is not a function". In batchesRetriesAndDeadLetters, the queues test clock is real time plus the test's advances, so the "late" message with a 1 s delay fell due on its own once the first batches took over a second, and it showed up early ("AssertionError: false == true").

In this patch hold() and release() meet through a latched gate, so either can come first, and "late" waits 60 s, which the test then advances the clock by. Sleeping 100 ms before hold() and 1.1 s in the first batch reproduces both failures locally. With this change the test passes with those sleeps in place, and 20 runs of each variant pass.

queues-test failed on the Windows runners in two ways, both from the test
itself. In evictionWaitsForDelivery, the consumer calls `add()` and then
`hold()` on the Seen object as two separate calls. The test waits for the
`add()` and calls `release()`, which can get there before `hold()` does,
and failed with "this[#held] is not a function". In
batchesRetriesAndDeadLetters, the queues test clock is real time plus the
test's advances, so the "late" message with a 1 s delay fell due on its
own once the first batches took over a second, and it showed up early.

In this patch `hold()` and `release()` meet through a latched gate, so
either can come first, and "late" waits 60 s, which the test then
advances the clock by. Sleeping 100 ms before `hold()` and 1.1 s in the
first batch reproduces both failures locally, and with this change the
test passes with those sleeps in place.
@littledivy
littledivy requested review from a team as code owners November 18, 2026 05:28

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 677c8ab6.

This review, of 31a7e488

✅ Approved — A test-only fix for two races. The latched gate and the longer delay both remove their race, and no issues were found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The latched gate lets release() arrive before or after hold(), and hold() re-arms it after it wakes. Every release() has a matching hold(), so no latched state carries into the next test. The 60 s delay plus the matching clock advance removes the race with real time in batchesRetriesAndDeadLetters.


📝 Documentation: ✅ LGTM

The updated comments describe how the code works now.


Reviewed commit: 31a7e488

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — A test-only fix for two races. The latched gate and the longer delay both remove their race, and no issues were found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The latched gate lets release() arrive before or after hold(), and hold() re-arms it after it wakes. Every release() has a matching hold(), so no latched state carries into the next test. The 60 s delay plus the matching clock advance removes the race with real time in batchesRetriesAndDeadLetters.


📝 Documentation: ✅ LGTM

The updated comments describe how the code works now.


Reviewed commit: 677c8ab6 — same changes as 31a7e488, so this is that commit's review (no new review was run; line numbers are as of 31a7e488)

@littledivy
littledivy merged commit bc7d179 into main Nov 18, 2026
36 of 37 checks passed
@littledivy
littledivy deleted the littledivy/2026-11-18-ci-main-flakes branch November 18, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants