Repository navigation
fix(tests): let the TZ flipper of the zone race yield - #8288
Merged
Merged
Conversation
The zone race of guest_time_conversion changes TZ in a tight loop while six threads convert times. On macOS the flipper keeps the guest environment lock: the default mutex there lets the thread that unlocks take the lock again before a woken waiter runs. The readers mostly waited, and the test ran for 21 seconds, past its 20-second timeout; a run with counters showed about 373 million TZ changes against the readers' 15,000 local time conversions. The flipper now yields after each change. It still changes TZ about 800,000 times while the readers convert, they see each zone in about half of their conversions, and the test takes about a second.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
12 tasks done
Contributor
|
Windows run of 070e447 merged onto Built |
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.
What
guest_time_conversion(#6916) times out on macOS. Its zone race changes TZ in a tight loop while six threads convert times, and on macOS the flipper keeps the guest environment lock: the default mutex there lets the thread that unlocks take the lock again before a woken waiter runs. The readers spend their time waiting on the zone and environment locks, and the test runs for 21 seconds, past its 20-second timeout. Part of the macOS series announced on #1 (#1 (comment)).The flipper now yields after each change. The readers still see TZ change under them all the time, so the race checks the same thing, and the test takes about a second on macOS.
Tested
macOS 26.5.1, Apple M5 Max, Apple clang 21, x86-64 build under Rosetta 2. The libraries do not link on macOS without the rest of the macOS series, so the run is on
main3fd1cc3 with the series (ci/macos-series-2on my fork), #8279, #8284, #8287, the open macOS fixes #7524 and #7937, and three changes from #7332.sampleprofile of the test: the readers spend about 90% of their samples waiting, inZoneScopeon the zone lock or inCopyGuestEnvironment_nid_no_patchon the environment lock. The flipper spends nearly half of its samples waking waiters when it unlocks.localtime_scalls, and the run took 39 seconds. With the yield, it changes TZ about 800,000 times, and the readers get each of the two offsets in about half of their calls, over three runs (7,427/7,573, 7,472/7,528 and 7,522/7,478). No conversion was torn in any run.guest_time_conversionpasses 5 runs of 5 under its 20-second timeout, in 0.5 to 1.3 seconds.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)