Boost C++ Libraries: Ticket #1834: boost::condition drops signals with notify_one() https://svn.boost.org/trac10/ticket/1834 <p> In a rather simple case of multiple threads waiting on a condition variable which are resumed by multiple calls to notify_one() we observed that since 1.35.0 some of the signals are dropped causing some threads to block forever. </p> <p> Attached is the (rather minimal) asynchronous queue implementation the we have used for quite some time now together with a simple test application that reproduces the problem. </p> <p> The problem was observed on several machines, both Single- and Multi-Core running both Windows XP SP2 and Windows Vista Business SP1. In all cases the test application was compiled with the Microsoft Visual Studio.Net 2005 SP1 compiler. </p> <p> We have observed that the issue is more likely to appear when:<br /> </p> <ol><li>There is some load on the system<br /> </li><li>The program is executed from within the Visual Sutio 2005 debugger.<br /> </li></ol><p> A concrete scenario where we could reproduce the problem quite reliably:<br /> </p> <ol><li>Start the task manager<br /> </li><li>Start the test application within the VS 2005 Debugger<br /> </li><li>Activate the task manager and monitor the thread count within the process list.<br /> </li></ol><p> Quite often (~ 2 out of 3 runs) the thread count stops changing a certain number, which marks the point at which all notify_one calls have been made, but not all threads have been awoken as a result. When the debugger is now used to break the application, all the remaining threads are waiting with interruptible_wait. Viewing the element count of the queue reveals that all elements have been successfully inserted into the queue, which is why we assume that some of the associated notifications have been dropped. </p> <p> While this problem can easily be avoided by replacing the notify_one() call with a call to notify_all(), we still believe that this is a bug in the new threads implementation as this queue (and it's associated unit-tests, which first showed the problem) have worked reliably with previous versions of Boost. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1834 Trac 1.4.3 Kimon.Hoffmann@… Thu, 17 Apr 2008 15:22:55 GMT attachment set https://svn.boost.org/trac10/ticket/1834 https://svn.boost.org/trac10/ticket/1834 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Boost_Thread_Bug.zip</span> </li> </ul> <p> Asynchronous queue implementation and a small test application </p> Ticket Kimon.Hoffmann@… Thu, 17 Apr 2008 15:24:30 GMT <link>https://svn.boost.org/trac10/ticket/1834#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1834#comment:1</guid> <description> <p> I will also test this under Linux tonight and will notify you whether or not I was able to reproduce the problem there. </p> </description> <category>Ticket</category> </item> <item> <author>Kimon.Hoffmann@…</author> <pubDate>Tue, 22 Apr 2008 13:26:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1834#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1834#comment:2</guid> <description> <p> I just retested the bug with the fix commited in revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/44699" title="Revamped condition variable to try and fix swallowed-notify problems ...">r44699</a> of the trunk and was no longer able to reproduce the described behavior. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Anthony Williams</dc:creator> <pubDate>Mon, 28 Apr 2008 08:56:34 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1834#comment:3 https://svn.boost.org/trac10/ticket/1834#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket