Boost logo

Boost Users :

Subject: [Boost-users] [pool] singleton_pool crash in multithreaded mode
From: Phil Bouchard (philippe_at_[hidden])
Date: 2011-05-07 00:14:28


Hi,

I have a strange bug here. I am using singleton_pool and it crashes at
a call to singleton_pool::ordered_malloc in multithreaded mode. The
funny thing is I am locking a mutex before the call and it still
crashes. The test file can be found here:
https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/example/thread_test.cpp

And the calls to the pool (allocate & deallocate) a made from class
"pool" of the following file:
https://svn.boost.org/svn/boost/sandbox/block_ptr/boost/detail/block_base.hpp

The backtrace I get is:
#0 0x0000000000407842 in boost::simple_segregated_storage<unsigned
long>::try_malloc_n (start=@0x42e7ddc0, n=10, partition_size=8)
     at
/home/vnmr1/phil/boost_1_46_1/boost/pool/simple_segregated_storage.hpp:236
#1 0x00000000004078f7 in boost::simple_segregated_storage<unsigned
long>::malloc_n (this=0x614d88, n=11, partition_size=8)
     at
/home/vnmr1/phil/boost_1_46_1/boost/pool/simple_segregated_storage.hpp:260
#2 0x000000000040c2ab in
boost::pool<boost::default_user_allocator_new_delete>::ordered_malloc
(this=0x614d88, n=88)
     at /home/vnmr1/phil/boost_1_46_1/boost/pool/pool.hpp:527
#3 0x000000000040c9b8 in boost::singleton_pool<boost::detail::sh::pool,
1u, boost::default_user_allocator_new_delete,
boost::details::pool::pthread_mutex, 32u, 0u>::ordered_malloc (n=88)
     at /home/vnmr1/phil/boost_1_46_1/boost/pool/singleton_pool.hpp:72
#4 0x000000000040d937 in boost::detail::sh::pool::allocate (s=88)
     at ../../../boost/detail/block_base.hpp:150
#5 0x000000000040d9cd in boost::detail::sh::block<std::pair<int, int>
>::operator new (s=88) at ../../../boost/detail/block_base.hpp:301
#6 0x000000000040d9f1 in boost::detail::sh::make_block<std::pair<int,
int>, std::pair<int, int> > (t0=@0x42e7e030) at
../../../boost/block_ptr.hpp:492
#7 0x0000000000405fd3 in worker (id=1) at thread_test.cpp:17
#8 0x0000000000408b5c in boost::_bi::list1<boost::_bi::value<int>
>::operator()<void (*)(int), boost::_bi::list0> (this=0x1776e660,
f=@0x1776e658,
     a=@0x42e7e0cf) at /home/vnmr1/phil/boost_1_46_1/boost/bind/bind.hpp:253
#9 0x0000000000408b9a in boost::_bi::bind_t<void, void (*)(int),
boost::_bi::list1<boost::_bi::value<int> > >::operator() (this=0x1776e658)
     at /home/vnmr1/phil/boost_1_46_1/boost/bind/bind_template.hpp:20
#10 0x0000000000408bb8 in
boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(int),
boost::_bi::list1<boost::_bi::value<int> > > >::run (
     this=0x1776e4d0)
     at /home/vnmr1/phil/boost_1_46_1/boost/thread/detail/thread.hpp:61
#11 0x00002b6910e0a914 in thread_proxy ()
    from /home/vnmr1/phil/lib/libboost_thread.so.1.46.1
#12 0x0000003906a06367 in start_thread () from /lib64/libpthread.so.0
#13 0x0000003905ed30ad in clone () from /lib64/libc.so.6

Anybody has any idea?

Thanks,
-Phil


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net