Opened 11 years ago
Closed 11 years ago
#5502 closed Patches (fixed)
race condition between shared_mutex timed_lock and lock_shared
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.49.0 | Component: | thread |
Version: | Boost Release Branch | Severity: | Showstopper |
Keywords: | Cc: | eliot@…, viboes |
Description
There is a potential race condition between 3 threads. Thread 1 - has a shared lock Thread 2 - goes into a timed_lock loop with a small sleep Thread 3 - tries shared_lock
Expected behavior: Thread 3 gets the lock when thread 2 fails to get exclusive lock.
What happens: based on timing, there can be a race condition causing a hang unless Thread 1 releases the lock.
Test and patch for boost-trunk that fixes the problem for me attached.
Attachments (2)
Change History (5)
by , 11 years ago
by , 11 years ago
Attachment: | patch.5502 added |
---|
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Cc: | added |
---|---|
Milestone: | To Be Determined → Boost 1.49.0 |
Owner: | changed from | to
Status: | new → assigned |
Type: | Bugs → Patches |
I have tested your patch and it works. Yes the issue is that when
state.exclusive_waiting_blocked=false;
the shared_cond variable must be notified also.
I have committed this at [76084]. To be closed when merged to release.
Thanks for catching this and, of course, for the solution.
any update on this?