Opened 10 years ago
Closed 10 years ago
#7755 closed Bugs (fixed)
Thread: deadlock with shared_mutex on Windows
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.54.0 | Component: | thread |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: | viboes |
Description
Please see attached test. Code is very simple. It works when thread3 uses thread3_func_workaround function and test is deadlocked when thread3 uses thread3_func function. From the first view, it seems the problem in the shared_mutex::timed_lock function. Possible it have to signal "semaphores[unlock_sem]" semaphore when state.exclusive_waiting_blocked is changed from true to false. This action will wake up threads which are waiting for shared access.
P.S. I didn't try the same test using pthread, so it is a good idea to test (and fix if needed) pthread implementation as well.
Attachments (2)
Change History (9)
by , 10 years ago
Attachment: | shared_mutex_deadlock.zip added |
---|
comment:1 by , 10 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 10 years ago
Defining BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN solves the issue!!!
comment:3 by , 10 years ago
Milestone: | To Be Determined |
---|---|
Resolution: | → duplicate |
Status: | assigned → closed |
comment:4 by , 10 years ago
Milestone: | → To Be Determined |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
Reopened as BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN will not be defined by default and as #7906 states there is a lost in performances when this define is defined.
by , 10 years ago
Attachment: | 7755.patch added |
---|
comment:5 by , 10 years ago
Replying to Andrey <nikolay@…>:
Please see attached test. Code is very simple. It works when thread3 uses thread3_func_workaround function and test is deadlocked when thread3 uses thread3_func function. From the first view, it seems the problem in the shared_mutex::timed_lock function. Possible it have to signal "semaphores[unlock_sem]" semaphore when state.exclusive_waiting_blocked is changed from true to false. This action will wake up threads which are waiting for shared access.
It seems your analysis were right. Please could you try the attached patch?
comment:6 by , 10 years ago
Milestone: | To Be Determined → Boost 1.54.0 |
---|
comment:7 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Committed revision [83525].
Hi, since 1.50 there is the possibility to use a common implementation for shared_mutex defining BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN or BOOST_THREAD_VERSION=3.
Please, could you tell me if this solves the issue?
See #4882.