Boost C++ Libraries: Ticket #7755: Thread: deadlock with shared_mutex on Windows https://svn.boost.org/trac10/ticket/7755 <p> 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> <p> 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. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7755 Trac 1.4.3 Andrey <nikolay@…> Sat, 01 Dec 2012 14:48:33 GMT attachment set https://svn.boost.org/trac10/ticket/7755 https://svn.boost.org/trac10/ticket/7755 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">shared_mutex_deadlock.zip</span> </li> </ul> Ticket viboes Sat, 01 Dec 2012 22:58:42 GMT owner, status changed; cc set https://svn.boost.org/trac10/ticket/7755#comment:1 https://svn.boost.org/trac10/ticket/7755#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> added </li> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> 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. </p> <p> Please, could you tell me if this solves the issue? </p> <p> See <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4882" title="#4882: Bugs: Win32 shared_mutex does not handle timeouts correctly (closed: fixed)">#4882</a>. </p> Ticket Andrey <nikolay@…> Mon, 03 Dec 2012 08:05:28 GMT <link>https://svn.boost.org/trac10/ticket/7755#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7755#comment:2</guid> <description> <p> Defining BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN solves the issue!!! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 03 Dec 2012 16:08:05 GMT</pubDate> <title>status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/7755#comment:3 https://svn.boost.org/trac10/ticket/7755#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> Ticket viboes Sat, 19 Jan 2013 10:42:30 GMT status changed; milestone set; resolution deleted https://svn.boost.org/trac10/ticket/7755#comment:4 https://svn.boost.org/trac10/ticket/7755#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">duplicate</span> </li> <li><strong>milestone</strong> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> Reopened as BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN will not be defined by default and as <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7906" title="#7906: Bugs: Very bad performance of generic implementation of shared_mutex on windows (closed: wontfix)">#7906</a> states there is a lost in performances when this define is defined. </p> Ticket viboes Sun, 03 Mar 2013 21:28:58 GMT attachment set https://svn.boost.org/trac10/ticket/7755 https://svn.boost.org/trac10/ticket/7755 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">7755.patch</span> </li> </ul> Ticket anonymous Sun, 03 Mar 2013 21:30:32 GMT <link>https://svn.boost.org/trac10/ticket/7755#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7755#comment:5</guid> <description> <p> Replying to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7755" title="#7755: Bugs: Thread: deadlock with shared_mutex on Windows (closed: fixed)">Andrey &lt;nikolay@…&gt;</a>: </p> <blockquote class="citation"> <p> 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> </blockquote> <p> It seems your analysis were right. Please could you try the attached patch? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 03 Mar 2013 21:46:00 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/7755#comment:6 https://svn.boost.org/trac10/ticket/7755#comment:6 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> </ul> Ticket viboes Sat, 23 Mar 2013 02:11:07 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7755#comment:7 https://svn.boost.org/trac10/ticket/7755#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/83525" title="Thread: merge from trunk. 1.54">[83525]</a>. </p> Ticket