Repository navigation
Fix the data race the thread sanitizer found in RegistryNetworkTests - #301
Merged
Merged
Conversation
…lock The URL loading system calls the protocol on its own threads while the test sets its statics up and tears them down. A late stopLoading raced tearDown clearing the expectation; the weekly thread sanitizer run caught it. Co-Authored-By: Claude Fable 5.2 <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.
The scheduled Thread Sanitizer run on main failed (run 43856065244). The race is in test code:
RegistryNetworkProtocol.stoppedis read by CFNetwork's thread instopLoading()whileRegistryNetworkTests.tearDown()clears it. It is intermittent — a rerun on CI passed; a local loop reproduced it on the first pass.The stub's four statics now sit behind one lock. No product code changes.
Checked with
swift test --sanitize=thread --filter MenubucketCoreTestsandhalt_on_error=1: reproduced before the change; 9 consecutive runs with 0 reports after (941 tests each).🤖 Generated with Claude Code