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
hpx::lcos::condition_variable could be suspect to deadlocks #3068
Comments
I'd assume you're talking about this code: https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/lcos/local/condition_variable.hpp#L50-L65 Here, the outer lock is re-acquired in the destructor of the
What condition should have been applied to that re-acquire operation? |
Yes, I am talking about this code. The outer lock being re-acquired while the inner lock is being held is exactly what will lead to a deadlock:
With "uncoditionally", I meant that we don't consider that another lock might be held when trying to acquire the other. |
This is a similiar issue to the one discussed in this article: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2406.html (kindly provided by @K-ballo on IRC) |
Fix #3068 (condition_variable deadlock)
The current code for
hpx::lcos::condition_variable
(and the_any
variant) might lead to deadlocks.The deadlock situation might, for example, be encountered, when concurrently calling
wait
.The problem is, that the outer lock (provided from the caller) is being tried to be acquired unconditionally with the inner lock (protecting the
lcos::detail::condition_variable
) is being held.The text was updated successfully, but these errors were encountered: