Batch mark waiters as unblocked when resuming in the deadlock handler#138874
Merged
bors merged 3 commits intorust-lang:masterfrom Mar 26, 2025
Merged
Batch mark waiters as unblocked when resuming in the deadlock handler#138874bors merged 3 commits intorust-lang:masterfrom
bors merged 3 commits intorust-lang:masterfrom
Conversation
Collaborator
|
r? @davidtwco rustbot has assigned @davidtwco. Use |
SparrowLii
reviewed
Mar 24, 2025
SparrowLii
reviewed
Mar 24, 2025
| for waiter in info.waiters.drain(..) { | ||
| waiter.notify(®istry); | ||
| rayon_core::mark_unblocked(®istry); | ||
| waiter.condvar.notify_one(); |
Member
There was a problem hiding this comment.
Do we also need to unblock all the waiters first here,which helps reduce the chance of deadlocks due to work-stealing?
Contributor
Author
There was a problem hiding this comment.
No, this runs on an active Rayon thread, which prevents it from hitting the deadlock handler until all threads are unblocked.
SparrowLii
approved these changes
Mar 24, 2025
davidtwco
approved these changes
Mar 24, 2025
Member
|
@bors r=SparrowLii,davidtwco |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 26, 2025
Rollup of 11 pull requests Successful merges: - rust-lang#138128 (Stabilize `#![feature(precise_capturing_in_traits)]`) - rust-lang#138834 (Group test diffs by stage in post-merge analysis) - rust-lang#138867 (linker: Fix staticlib naming for UEFI) - rust-lang#138874 (Batch mark waiters as unblocked when resuming in the deadlock handler) - rust-lang#138875 (Trusty: Fix build for anonymous pipes and std::sys::process) - rust-lang#138877 (Ignore doctests only in specified targets) - rust-lang#138885 (Fix ui pattern_types test for big-endian platforms) - rust-lang#138905 (Add target maintainer information for powerpc64-unknown-linux-musl) - rust-lang#138911 (Allow defining opaques in statics and consts) - rust-lang#138917 (rustdoc: remove useless `Symbol::is_empty` checks.) - rust-lang#138945 (Override PartialOrd methods for bool) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 26, 2025
Rollup merge of rust-lang#138874 - Zoxc:waiter-race, r=SparrowLii,davidtwco Batch mark waiters as unblocked when resuming in the deadlock handler This fixes a race when resuming multiple threads to resolve query cycles. This now marks all threads as unblocked before resuming any of them. Previously if one was resumed and marked as unblocked at a time. The first thread resumed could fall asleep then Rayon would detect a second false deadlock. Later the initial deadlock handler thread would resume further threads. This also reverts the workaround added in rust-lang#137731. cc `@SparrowLii` `@lqd`
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Apr 2, 2025
Rollup of 11 pull requests Successful merges: - rust-lang#138128 (Stabilize `#![feature(precise_capturing_in_traits)]`) - rust-lang#138834 (Group test diffs by stage in post-merge analysis) - rust-lang#138867 (linker: Fix staticlib naming for UEFI) - rust-lang#138874 (Batch mark waiters as unblocked when resuming in the deadlock handler) - rust-lang#138875 (Trusty: Fix build for anonymous pipes and std::sys::process) - rust-lang#138877 (Ignore doctests only in specified targets) - rust-lang#138885 (Fix ui pattern_types test for big-endian platforms) - rust-lang#138905 (Add target maintainer information for powerpc64-unknown-linux-musl) - rust-lang#138911 (Allow defining opaques in statics and consts) - rust-lang#138917 (rustdoc: remove useless `Symbol::is_empty` checks.) - rust-lang#138945 (Override PartialOrd methods for bool) r? `@ghost` `@rustbot` modify labels: rollup
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.
This fixes a race when resuming multiple threads to resolve query cycles. This now marks all threads as unblocked before resuming any of them. Previously if one was resumed and marked as unblocked at a time. The first thread resumed could fall asleep then Rayon would detect a second false deadlock. Later the initial deadlock handler thread would resume further threads.
This also reverts the workaround added in #137731.
cc @SparrowLii @lqd