Repository navigation
Fix two races in queues-test - #8585
Conversation
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
✅ 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)
queues-test failed on the Windows runners in two ways, both from the test itself. In
evictionWaitsForDelivery, the consumer callsadd()and thenhold()on the Seen object as two separate calls. The test waits for theadd()and callsrelease(), which can get there beforehold()does, and it failed with "this[#held] is not a function". InbatchesRetriesAndDeadLetters, 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()andrelease()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 beforehold()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.