test(utils): wait for the read only lock to register before probing - #4943
Draft
colinbarry wants to merge 3 commits into
Draft
colinbarry wants to merge 3 commits into
colinbarry wants to merge 3 commits into
Conversation
Contributor
Author
Tracking
Standard development
CI Testing Labels
Documentation checklist
|
colinbarry
force-pushed
the
fix/flaky-prioritise-readonly-lock
branch
from
September 29, 2026 11:19
433c5af to
154c0cd
Compare
Contributor
colinbarry
force-pushed
the
fix/flaky-prioritise-readonly-lock
branch
2 times, most recently
from
September 29, 2026 11:24
f34e865 to
3c24d4c
Compare
PrioritiseReadOnlyLock slept 15ms after its latch, hoping the deferred thread had reached lock() and registered as pending, then probed once with a WRITE try_lock. Under CPU load the probe lands first, sees a gate that is legitimately still open, acquires, and fails the test. The probe now retries until the gate is observably closed. A WRITE refused here can only be the pending READ_ONLY, since the WRITE the test already holds is compatible with another WRITE. The failure also hung the binary: the assertion returned from the test body while the deferred thread was still parked in lock(), and only the release the test never reached could free it, so ~future blocked until the job timeout. The release now happens before the result is reported. The worker also asks for std::launch::async explicitly. Without it a deferred launch runs nothing until get(), and the test blocks on a latch whose other arrival never comes. Closes #4941
colinbarry
force-pushed
the
fix/flaky-prioritise-readonly-lock
branch
from
September 29, 2026 13:14
3c24d4c to
912e717
Compare
The retry loop waited up to 60s for the deferred thread to register as pending. The whole binary shares a 120s ctest budget across 37 tests, so a broken lock spent half of it spinning before reporting. The wait is one mutex acquisition, and 5s matches the watchdog bounds the rest of the file already uses.
The worker's early-return checks ran before it reached the latch, so a broken lock left the main thread waiting at the latch forever. The worker now arrives first, and the failure message names both causes of an ungated WRITE.
|
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.



ResourceLockTest.PrioritiseReadOnlyLockslept 15ms after its latch, hoping the deferred thread had reachedlock()and registered as pending, then probed once with a WRITEtry_lock. The latch only says the thread is about to calllock(), so under CPU load the probe lands first, sees a gate that is legitimately still open, acquires, and fails the test. The failure then hung the binary rather than reporting: the assertion returned from the test body while the deferred thread was still parked inlock(), and only the release the test never reached could free it, so~futureblocked until the job timeout.The probe now retries until the gate is observably closed, and the release happens before the result is reported. A WRITE refused there can only be the pending READ_ONLY, since the WRITE the test already holds is compatible with another WRITE. The worker also asks for
std::launch::asyncexplicitly; without it a deferred launch runs nothing untilget(), and the test blocks on a latch whose other arrival never comes.Closes #4941