-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accelerated DAG channel lock fixes #45119
Merged
Merged
Conversation
This file contains 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
stephanie-wang
approved these changes
May 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a unit test for this?
jackhumphries
force-pushed
the
lock-fix
branch
2 times, most recently
from
May 3, 2024 07:37
8f25ae2
to
53837bc
Compare
This is ready for review. Thanks Stephanie! |
stephanie-wang
approved these changes
May 11, 2024
stephanie-wang
added a commit
that referenced
this pull request
May 13, 2024
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 6, 2024
This PR fixes two issues: 1. When the error bit is set on a mutable object, a reader may return from ReadAcquire() without releasing the channel lock. This will cause deadlock if another reader calls ReadAcquire() on the channel. 2. Abseil reports a deadlock on the channel lock, though this is a false positive. Note that Abseil only tracks deadlocks when compiled with debug mode (`export RAY_DEBUG_BUILD=debug`), so this issue will not appear otherwise. Specifically, the following occurs: (1) Abseil sees ReadAcquire() acquire the destructor lock followed by the _input_ channel lock. (2) When WriteAcquire() is called on the _output_ channel, Abseil sees that the thread already holds the _input_ channel lock and then the thread acquires the destructor lock. (3) Since Abseil sees these locks acquired in the reverse order in (2), it thinks there could be a deadlock. The deadlock check can only be disabled globally, which is undesirable, rather than for a specific lock. To resolve this issue for now, I replace absl::Mutex with std::mutex so that Abseil does not track deadlock on this lock. A better long-term solution is to rework the synchronization model so that a lock is not held after ReadAcquire() returns. --------- Signed-off-by: Jack Humphries <1645405+jackhumphries@users.noreply.github.com> Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 6, 2024
Fixes test that was broken due a hidden merge conflict between ray-project#45092 and ray-project#45119. Related issue number Closes ray-project#45264. Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu> Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 6, 2024
This PR fixes two issues: 1. When the error bit is set on a mutable object, a reader may return from ReadAcquire() without releasing the channel lock. This will cause deadlock if another reader calls ReadAcquire() on the channel. 2. Abseil reports a deadlock on the channel lock, though this is a false positive. Note that Abseil only tracks deadlocks when compiled with debug mode (`export RAY_DEBUG_BUILD=debug`), so this issue will not appear otherwise. Specifically, the following occurs: (1) Abseil sees ReadAcquire() acquire the destructor lock followed by the _input_ channel lock. (2) When WriteAcquire() is called on the _output_ channel, Abseil sees that the thread already holds the _input_ channel lock and then the thread acquires the destructor lock. (3) Since Abseil sees these locks acquired in the reverse order in (2), it thinks there could be a deadlock. The deadlock check can only be disabled globally, which is undesirable, rather than for a specific lock. To resolve this issue for now, I replace absl::Mutex with std::mutex so that Abseil does not track deadlock on this lock. A better long-term solution is to rework the synchronization model so that a lock is not held after ReadAcquire() returns. --------- Signed-off-by: Jack Humphries <1645405+jackhumphries@users.noreply.github.com> Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 6, 2024
Fixes test that was broken due a hidden merge conflict between ray-project#45092 and ray-project#45119. Related issue number Closes ray-project#45264. Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu> Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 7, 2024
This PR fixes two issues: 1. When the error bit is set on a mutable object, a reader may return from ReadAcquire() without releasing the channel lock. This will cause deadlock if another reader calls ReadAcquire() on the channel. 2. Abseil reports a deadlock on the channel lock, though this is a false positive. Note that Abseil only tracks deadlocks when compiled with debug mode (`export RAY_DEBUG_BUILD=debug`), so this issue will not appear otherwise. Specifically, the following occurs: (1) Abseil sees ReadAcquire() acquire the destructor lock followed by the _input_ channel lock. (2) When WriteAcquire() is called on the _output_ channel, Abseil sees that the thread already holds the _input_ channel lock and then the thread acquires the destructor lock. (3) Since Abseil sees these locks acquired in the reverse order in (2), it thinks there could be a deadlock. The deadlock check can only be disabled globally, which is undesirable, rather than for a specific lock. To resolve this issue for now, I replace absl::Mutex with std::mutex so that Abseil does not track deadlock on this lock. A better long-term solution is to rework the synchronization model so that a lock is not held after ReadAcquire() returns. --------- Signed-off-by: Jack Humphries <1645405+jackhumphries@users.noreply.github.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 7, 2024
Fixes test that was broken due a hidden merge conflict between ray-project#45092 and ray-project#45119. Related issue number Closes ray-project#45264. Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
GabeChurch
pushed a commit
to GabeChurch/ray
that referenced
this pull request
Jun 11, 2024
This PR fixes two issues: 1. When the error bit is set on a mutable object, a reader may return from ReadAcquire() without releasing the channel lock. This will cause deadlock if another reader calls ReadAcquire() on the channel. 2. Abseil reports a deadlock on the channel lock, though this is a false positive. Note that Abseil only tracks deadlocks when compiled with debug mode (`export RAY_DEBUG_BUILD=debug`), so this issue will not appear otherwise. Specifically, the following occurs: (1) Abseil sees ReadAcquire() acquire the destructor lock followed by the _input_ channel lock. (2) When WriteAcquire() is called on the _output_ channel, Abseil sees that the thread already holds the _input_ channel lock and then the thread acquires the destructor lock. (3) Since Abseil sees these locks acquired in the reverse order in (2), it thinks there could be a deadlock. The deadlock check can only be disabled globally, which is undesirable, rather than for a specific lock. To resolve this issue for now, I replace absl::Mutex with std::mutex so that Abseil does not track deadlock on this lock. A better long-term solution is to rework the synchronization model so that a lock is not held after ReadAcquire() returns. --------- Signed-off-by: Jack Humphries <1645405+jackhumphries@users.noreply.github.com> Signed-off-by: gchurch <gabe1church@gmail.com>
GabeChurch
pushed a commit
to GabeChurch/ray
that referenced
this pull request
Jun 11, 2024
Fixes test that was broken due a hidden merge conflict between ray-project#45092 and ray-project#45119. Related issue number Closes ray-project#45264. Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu> Signed-off-by: gchurch <gabe1church@gmail.com>
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.
Why are these changes needed?
This PR fixes two issues:
When the error bit is set on a mutable object, a reader may return from ReadAcquire() without releasing the channel lock. This will cause deadlock if another reader calls ReadAcquire() on the channel.
Abseil reports a deadlock on the channel lock, though this is a false positive. Note that Abseil only tracks deadlocks when compiled with debug mode (
export RAY_DEBUG_BUILD=debug
), so this issue will not appear otherwise.Specifically, the following occurs:
(1) Abseil sees ReadAcquire() acquire the destructor lock followed by the input channel lock.
(2) When WriteAcquire() is called on the output channel, Abseil sees that the thread already holds the input channel lock and then the thread acquires the destructor lock.
(3) Since Abseil sees these locks acquired in the reverse order in (2), it thinks there could be a deadlock.
The deadlock check can only be disabled globally, which is undesirable, rather than for a specific lock. To resolve this issue for now, I replace absl::Mutex with std::mutex so that Abseil does not track deadlock on this lock.
A better long-term solution is to rework the synchronization model so that a lock is not held after ReadAcquire() returns.
Related issue number
N/A
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.