Boost C++ Libraries: Ticket #1168: [thread] tss crashes randomly https://svn.boost.org/trac10/ticket/1168 <p> Experienced with Mac OS 10.4.10 on an Intel-based Mac. The problem occurs with both 1.34 release and current trunk. </p> <p> I had difficulties writing a minimalist program that reproduces the problem often enough to be catchable with a debugger. </p> <p> The following gdb session illustrates the problem and was created executing the test 'trd_sp_singleton_threading' from the singleton archive in the vault <a class="ext-link" href="http://tinyurl.com/35vlvb"><span class="icon">​</span>http://tinyurl.com/35vlvb</a> (a backport of Boost.<a class="missing wiki">FunctionTypes</a> is needed to compile the test with 1.34 <a class="ext-link" href="http://tinyurl.com/qaf5f"><span class="icon">​</span>http://tinyurl.com/qaf5f</a> - not needed with the trunk version): </p> <hr /> <p> Program exited normally. (gdb) r Starting program: /Users/tosh/Lab/boost_1_34_1/bin.v2/libs/utility/singleton/test/trd_sp_singleton_threading.test/darwin/debug/threading-multi/a.out No errors detected. </p> <p> Program exited normally. (gdb) r Starting program: /Users/tosh/Lab/boost_1_34_1/bin.v2/libs/utility/singleton/test/trd_sp_singleton_threading.test/darwin/debug/threading-multi/a.out No errors detected. </p> <p> Program exited normally. (gdb) r Starting program: /Users/tosh/Lab/boost_1_34_1/bin.v2/libs/utility/singleton/test/trd_sp_singleton_threading.test/darwin/debug/threading-multi/a.out </p> <p> &lt;snip ...&gt; </p> <p> Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x448ca20d [Switching to process 734 thread 0x2103] 0x8fe12eb7 in <span class="underline">dyld</span>ZN16ImageLoaderMachOC1EPKciPKhyyRK4statRKN11ImageLoader11LinkContextE () (gdb) bt <a class="missing ticket">#0</a> 0x8fe12eb7 in <span class="underline">dyld</span>ZN16ImageLoaderMachOC1EPKciPKhyyRK4statRKN11ImageLoader11LinkContextE () <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> 0x0003724e in std::vector&lt;void*, std::allocator&lt;void*&gt; &gt;::insert (this=0x3004c0, <span class="underline">position={_M_current = 0x0}, </span>n=1, <span class="underline">x=@0xb0203d9c) at /usr/include/c++/4.0.0/bits/stl_vector.h:658 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x000372fd in std::vector&lt;void*, std::allocator&lt;void*&gt; &gt;::resize (this=0x3004c0, </span>new_size=1, <span class="underline">x=@0xb0203d9c) at /usr/include/c++/4.0.0/bits/stl_vector.h:427 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> 0x0003732a in std::vector&lt;void*, std::allocator&lt;void*&gt; &gt;::resize (this=0x3004c0, </span>new_size=1) at /usr/include/c++/4.0.0/bits/stl_vector.h:442 <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> 0x000339bc in boost::detail::tss::set (this=0x6264, value=0x3004a0) at ../../../../libs/thread/src/tss.cpp:231 <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> 0x0000380b in boost::thread_specific_ptr&lt;boost::thread_specific_singleton&lt;X, 0&gt;::instance_proxy::holder&gt;::reset (this=0x6260, p=0x3004a0) at ../../../../boost/thread/tss.hpp:100 <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> 0x000038b2 in boost::thread_specific_singleton&lt;X, 0&gt;::instance_proxy::get () at ../../../../boost/utility/thread_specific_singleton.hpp:100 <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> 0x0000390d in boost::thread_specific_singleton&lt;X, 0&gt;::instance_proxy::operator-&gt; (this=0x60e0) at ../../../../boost/utility/thread_specific_singleton.hpp:60 <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> 0x00002699 in test1 () at trd_sp_singleton_threading.cpp:47 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9" title="#9: Bugs: config_info ambiguity error (closed: Invalid)">#9</a> 0x00003c23 in boost::detail::function::void_function_invoker0&lt;void (*)(), void&gt;::invoke (function_ptr=@0xb0203f20) at ../../../../boost/function/function_template.hpp:114 <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> 0x00034d45 in boost::function0&lt;void, std::allocator&lt;boost::function_base&gt; &gt;::operator() (this=0xb0203f1c) at ../../../../boost/function/function_template.hpp:692 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11" title="#11: Bugs: why not using mt19937? (closed: Fixed)">#11</a> 0x000325d0 in thread_proxy (param=0xbfffefa8) at ../../../../libs/thread/src/thread.cpp:108 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12" title="#12: Bugs: Can't specify VertexPredicate (closed: Fixed)">#12</a> 0x90024227 in _pthread_body () (gdb) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1168 Trac 1.4.3 t_schwinger Sat, 11 Aug 2007 20:56:45 GMT attachment set https://svn.boost.org/trac10/ticket/1168 https://svn.boost.org/trac10/ticket/1168 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">tss_bug.cpp</span> </li> </ul> <p> Attempt of minimal reconstruction of the problem. Could crash it in a batch loop - crash too unlikely for debugging </p> Ticket t_schwinger Sun, 12 Aug 2007 20:17:06 GMT <link>https://svn.boost.org/trac10/ticket/1168#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1168#comment:1</guid> <description> <p> Maybe related to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1154" title="#1154: Bugs: tss destruction segfaults in conjunction with dlopen/dlclose (closed: fixed)">#1154</a>. No exact duplicate - also happens with statically linked program. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Anthony Williams</dc:creator> <pubDate>Tue, 27 May 2008 16:54:14 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1168#comment:2 https://svn.boost.org/trac10/ticket/1168#comment:2 <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">worksforme</span> </li> </ul> <p> I can't duplicate the problem, but the TSS code has changed since 1.34.1, so it might have been fixed. </p> Ticket