Boost C++ Libraries: Ticket #5846: Boost::Test: intermittent crash during testing https://svn.boost.org/trac10/ticket/5846 <p> Our tests spin up 64 threads and then exercise various objects. Upon thread exit, the thread prints a simple message (args.id is the internal thread number): </p> <pre class="wiki">BOOST_MESSAGE( "Thread " &lt;&lt; args.id &lt;&lt; " completed" ); </pre><p> The problem is tough to reproduce, but I've got one under the debugger. It appears Boost::Test has missed a lock in execution_monitor. </p> <p> We are compiling with both CXXFLAGS += -D_REENTRANT and LDLIBS += -lpthread. Boost::Test compilation page (<a href="http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/execution-monitor/compilation.html">http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/execution-monitor/compilation.html</a>) does not specify any additional flags for multithreaded testing, and the FAQ (<a href="http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/faq.html">http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/faq.html</a>) does not mention any special steps. </p> <h3 class="section" id="Console1">Console 1</h3> <p> $ ./test/run_esapi_tests Running 30 test cases... terminate called after throwing an instance of 'std::length_error' </p> <blockquote> <p> what(): basic_string::_S_create </p> </blockquote> <p> [Program hangs here] </p> <h3 class="section" id="Console2">Console 2</h3> <p> $ ps -a </p> <blockquote> <p> PID TTY TIME CMD </p> </blockquote> <p> 14779 pts/0 00:00:01 run_esapi_tests 14846 pts/1 00:00:00 ps $ gdb attach 14779 GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. ... Loaded symbols for /lib/libpthread.so.0 ... Loaded symbols for /lib/librt.so.1 <span class="underline">lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136 136 ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory. </span></p> <blockquote> <p> in ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S </p> </blockquote> <p> (gdb) where <a class="missing ticket">#0</a> <span class="underline">lll_lock_wait () </span></p> <blockquote> <p> at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> 0x00007f24bdc595f4 in _L_lock_1024 () from /lib/libpthread.so.0 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x00007f24bdc59457 in <span class="underline">pthread_mutex_lock (mutex=0x7f24be08d948) </span></p> <blockquote> <p> at pthread_mutex_lock.c:82 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> 0x00007f24bcb1155b in *<span class="underline">GI</span>_dl_iterate_phdr ( </p> <blockquote> <p> callback=0x7f24bcd81910 &lt;_Unwind_IteratePhdrCallback&gt;, data=0x80) at dl-iteratephdr.c:42 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4" title="#4: Bugs: any_ptr in any library documentation? (closed: Fixed)">#4</a> 0x00007f24bcd8263f in _Unwind_Find_FDE (pc=0x7f24bcd80b1d, </p> <blockquote> <p> bases=0x7fffa8e28498) at ../../../src/libgcc/../gcc/unwind-dw2-fde-glibc.c:417 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5" title="#5: Bugs: shared_ptr and self-owning objects (closed: Fixed)">#5</a> 0x00007f24bcd7fb93 in uw_frame_state_for (context=0x7fffa8e283f0, </p> <blockquote> <p> fs=&lt;value optimized out&gt;) at ../../../src/libgcc/../gcc/unwind-dw2.c:1128 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6" title="#6: Bugs: tie in utility.hpp and tuple.hpp clash. (closed: Duplicate)">#6</a> 0x00007f24bcd804a9 in uw_init_context_1 (context=0x7fffa8e283f0, </p> <blockquote> <p> outer_cfa=0x7fffa8e28530, outer_ra=0x7f24bcf861c0) at ../../../src/libgcc/../gcc/unwind-dw2.c:1447 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7" title="#7: Bugs: g++ 2.96 requires NO_STRINGSTREAM (closed: Fixed)">#7</a> 0x00007f24bcd80b1e in _Unwind_RaiseException (exc=0x125a8a0) </p> <blockquote> <p> at ../../../src/libgcc/../gcc/unwind.inc:88 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8" title="#8: Bugs: prop in undirected graph + out_edges (closed: Works For Me)">#8</a> 0x00007f24bd2d4e31 in <span class="underline">cxa_throw (obj=&lt;value optimized out&gt;, tinfo=0x80, </span></p> <blockquote> <p> dest=0) at ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:78 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9" title="#9: Bugs: config_info ambiguity error (closed: Invalid)">#9</a> 0x00007f24bd9e755a in boost::execution_monitor::catch_signals ( </p> <blockquote> <p> this=&lt;value optimized out&gt;, F=&lt;value optimized out&gt;) at ./boost/test/impl/execution_monitor.ipp:958 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10" title="#10: Bugs: allyourbase.jam file is bad. (closed: Out of Date)">#10</a> 0x00007f24bd9e759b in boost::execution_monitor::execute ( </p> <blockquote> <p> this=0x7f24bdc4f8c0, F=...) at ./boost/test/impl/execution_monitor.ipp:1282 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11" title="#11: Bugs: why not using mt19937? (closed: Fixed)">#11</a> 0x00007f24bda01d8c in boost::unit_test::unit_test_monitor_t::execute_and_translate (this=0x7f24bdc4f8c0, tc=&lt;value optimized out&gt;) </p> <blockquote> <p> at ./boost/test/impl/unit_test_monitor.ipp:69 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12" title="#12: Bugs: Can't specify VertexPredicate (closed: Fixed)">#12</a> 0x00007f24bd9f2941 in boost::unit_test::framework_impl::visit ( </p> <blockquote> <p> this=0x7f24bdc4f800, tc=&lt;value optimized out&gt;) at ./boost/test/impl/framework.ipp:150 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/13" title="#13: Bugs: iterator_adapter and abstract classes (closed: Out of Date)">#13</a> 0x00007f24bda21763 in boost::unit_test::traverse_test_tree (suite=..., </p> <blockquote> <p> V=...) at ./boost/test/impl/unit_test_suite.ipp:207 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/14" title="#14: Feature Requests: Support for static data members (closed: Out of Date)">#14</a> 0x00007f24bd9efc28 in boost::unit_test::framework::run ( </p> <blockquote> <p> id=&lt;value optimized out&gt;, continue_test=16) at ./boost/test/impl/framework.ipp:436 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/15" title="#15: Feature Requests: thread class needs join() with timeout (closed: None)">#15</a> 0x00007f24bd9fed43 in boost::unit_test::unit_test_main ( </p> <blockquote> <p> init_func=&lt;value optimized out&gt;, argc=&lt;value optimized out&gt;, argv=&lt;value optimized out&gt;) at ./boost/test/impl/unit_test_main.ipp:185 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/16" title="#16: Feature Requests: way to defer thread creation needed (closed: None)">#16</a> 0x000000000042e402 in main (argc=1, argv=0x7fffa8e295e8) </p> <blockquote> <p> at /usr/include/boost/test/unit_test.hpp:59 </p> </blockquote> <p> (gdb) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5846 Trac 1.4.3 noloader@… Tue, 30 Aug 2011 08:51:25 GMT <link>https://svn.boost.org/trac10/ticket/5846#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5846#comment:1</guid> <description> <p> Whoops.... better join this bug report. </p> </description> <category>Ticket</category> </item> <item> <author>Jeffrey Walton <noloader@…></author> <pubDate>Wed, 31 Aug 2011 00:49:36 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/5846#comment:2 https://svn.boost.org/trac10/ticket/5846#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Gennadiy Rozental</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">test</span> </li> </ul> Ticket Jeffrey Walton <noloader@…> Wed, 31 Aug 2011 00:50:46 GMT cc set https://svn.boost.org/trac10/ticket/5846#comment:3 https://svn.boost.org/trac10/ticket/5846#comment:3 <ul> <li><strong>cc</strong> <span class="trac-author">noloader@…</span> added </li> </ul> Ticket Jeffrey Walton <noloader@…> Wed, 31 Aug 2011 01:07:28 GMT <link>https://svn.boost.org/trac10/ticket/5846#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5846#comment:4</guid> <description> <p> My bad - this should be against 1.40, not 1.47. </p> </description> <category>Ticket</category> </item> <item> <author>Jeffrey Walton <noloader@…></author> <pubDate>Wed, 31 Aug 2011 01:13:53 GMT</pubDate> <title>version changed https://svn.boost.org/trac10/ticket/5846#comment:5 https://svn.boost.org/trac10/ticket/5846#comment:5 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.47.0</span> → <span class="trac-field-new">Boost 1.40.0</span> </li> </ul> Ticket Jeffrey Walton <noloader@…> Wed, 31 Aug 2011 01:15:11 GMT keywords set https://svn.boost.org/trac10/ticket/5846#comment:6 https://svn.boost.org/trac10/ticket/5846#comment:6 <ul> <li><strong>keywords</strong> multithreaded crash execution_monitor added </li> </ul> Ticket Gennadiy Rozental Mon, 17 Oct 2011 05:43:09 GMT <link>https://svn.boost.org/trac10/ticket/5846#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5846#comment:7</guid> <description> <p> what lock you refer to? </p> <p> Boost.Test never promised to be thread safe. All synchronization for now is user responsibility. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gennadiy Rozental</dc:creator> <pubDate>Sun, 23 Oct 2011 20:19:58 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5846#comment:8 https://svn.boost.org/trac10/ticket/5846#comment:8 <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">wontfix</span> </li> </ul> <p> Let's reconsider this once Boost.Test start using C++11 synchronization primitives </p> Ticket