Boost C++ Libraries: Ticket #5526: fast_pool_allocator crash https://svn.boost.org/trac10/ticket/5526 <p> Hi, </p> <p> I made some changes to the Block Pointer and now I am using a static pool and a static list of intervals that in turn is using the fast_pool_allocator. The destruction of the list with therefore be done and the end of the application, the problem is I experience a crash when the list is getting cleared at that moment. The application is located here: <a class="ext-link" href="https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test3.cpp"><span class="icon">​</span>https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test3.cpp</a> </p> <p> If I don't use the fast_pool_allocator then the bug goes away. The backtrace I get is: </p> <p> <a class="missing ticket">#0</a> 0x000000000042c51e in std::_List_base&lt;boost::numeric::interval&lt;long, boost::numeric::interval_lib::policies&lt;boost::numeric::interval_lib::rounded_math&lt;long&gt;, boost::numeric::interval_lib::checking_strict&lt;long&gt; &gt; &gt;, boost::fast_pool_allocator&lt;boost::numeric::interval&lt;long, boost::numeric::interval_lib::policies&lt;boost::numeric::interval_lib::rounded_math&lt;long&gt;, boost::numeric::interval_lib::checking_strict&lt;long&gt; &gt; &gt;, boost::default_user_allocator_new_delete, boost::details::pool::pthread_mutex, 32u, 0u&gt; &gt;::_M_clear (this=0x1d6a3ca0) </p> <blockquote> <p> at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/list.tcc:76 </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> 0x000000000042c579 in ~_List_base (this=0x1d6a3ca0) </p> <blockquote> <p> at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_list.h:339 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x000000000042c591 in ~list (this=0x1d6a3ca0) </p> <blockquote> <p> at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_list.h:399 </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> 0x000000000042c5bc in boost::thread_specific_ptr&lt;std::list&lt;boost::numeric::interval&lt;long, boost::numeric::interval_lib::policies&lt;boost::numeric::interval_lib::rounded_math&lt;long&gt;, boost::numeric::interval_lib::checking_strict&lt;long&gt; &gt; &gt;,boost::fast_pool_allocator&lt;boost::numeric::interval&lt;long, boost::numeric::interval_lib::policies&lt;boost::numeric::interval_lib::rounded_math&lt;long&gt;, boost::numeric::interval_lib::checking_strict&lt;long&gt; &gt; &gt;, boost::default_user_allocator_new_delete, boost::details::pool::pthread_mutex, 32u, 0u&gt; &gt; &gt;::delete_data::operator() </p> <blockquote> <p> (this=0x1d69f300, data=0x1d6a3ca0) </p> <blockquote> <p> at /home/vnmr1/phil/boost_1_46_1/boost/thread/tss.hpp:42 </p> </blockquote> </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> 0x00002abe08ee2d77 in boost::detail::set_tss_data () </p> <blockquote> <p> from /home/vnmr1/phil/lib/libboost_thread.so.1.46.1 </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> 0x000000000042dd05 in ~thread_specific_ptr (this=0x681a80) </p> <blockquote> <p> at /home/vnmr1/phil/boost_1_46_1/boost/thread/tss.hpp:79 </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> 0x000000000040a744 in <span class="underline">tcf_9 () </span></p> <blockquote> <p> at ../../../boost/detail/block_base.hpp:183 </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> 0x0000003905e33355 in exit () from /lib64/libc.so.6 <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> 0x0000003905e1d97b in <span class="underline">libc_start_main () from /lib64/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9" title="#9: Bugs: config_info ambiguity error (closed: Invalid)">#9</a> 0x000000000040a2c9 in _start () </span></p> <p> Thanks, -Phil </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5526 Trac 1.4.3 anonymous Sun, 15 May 2011 09:55:56 GMT <link>https://svn.boost.org/trac10/ticket/5526#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5526#comment:1</guid> <description> <p> I've tracked the cause of this - it's because you have code using singleton_pool from a globally-scoped thread_specific_ptr. This then runs into order-of-destruction issues, with the global pool's destructor being called before that of the thread_specific_ptr's (which gets called <em>very</em> late due to the way it's implemented). </p> <p> In general, this one's going to be very hard to fix, but I'll think about it ;-) </p> <p> John. </p> </description> <category>Ticket</category> </item> <item> <author>philippeb8@…</author> <pubDate>Sun, 15 May 2011 17:28:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5526#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5526#comment:2</guid> <description> <p> I changed thread_specific_ptr to an auto_ptr and I still have the crash. There is a problem with the destruction order of fast_pool_allocator. </p> <p> I changed my code to use a static thread_specific_ptr from within a static function and the crash went away because thread_specific_ptr gets detroyed before any of fast_pool_allocator's internal static objects (I imagine there are static objects inside fast_pool_allocator). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 15 Jul 2011 17:40:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5526#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5526#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/73121" title="Add some debugging code. Add tentative Valgrind support. Change ...">[73121]</a>) Add some debugging code. Add tentative Valgrind support. Change singleton usage to address issue 5526 by making singletons eternal. Add Valgrind tests. Update docs to match. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5526" title="#5526: Bugs: fast_pool_allocator crash (closed: fixed)">#5526</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 02 Aug 2011 17:04:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5526#comment:4 https://svn.boost.org/trac10/ticket/5526#comment:4 <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> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/73495" title="Merge updated Pool lib from trunk. Fixes #1252. Fixes #2696. Fixes ...">[73495]</a>) Merge updated Pool lib from trunk. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1252" title="#1252: Bugs: [pool] severe overhead with unaligned sizes. (closed: fixed)">#1252</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2696" title="#2696: Bugs: max_size for boost pool (closed: fixed)">#2696</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4960" title="#4960: Bugs: boost::pool_allocator for vector of vectors exhausts memory (closed: fixed)">#4960</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5526" title="#5526: Bugs: fast_pool_allocator crash (closed: fixed)">#5526</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5568" title="#5568: Bugs: singleton_pool doesn't propagate MaxSize value to his pool (closed: fixed)">#5568</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5700" title="#5700: Bugs: warning in object_pool.hpp:56 (closed: fixed)">#5700</a>. </p> Ticket