Boost logo

Boost Users :

Subject: [Boost-users] interprocess::rbtree_best_fit assertion failure with vector resize
From: John Harris (jharris_at_[hidden])
Date: 2014-12-22 08:22:38


I encountered this with 1.56 and 1.57 under heavy allocation load where I repeatedly resize an interprocess vector<unsigned char>. The only way I was able to get around it was to switch to the simple_seq_fit allocation algorithm.

The assertion is assert(FALSE), and so I'm wondering if the algorithm doesn't handle all cases where there is a single-byte type for the vector.

The stack below is from a core dump, and so the "Cannot access memory" errors are not necessarily indicative of bad pointers.

#3 0x0000003dc2a2b820 in __assert_fail () from /lib64/libc.so.6
#4 0x00007f869a166793 in boost::container::container_detail::insert_value_initialized_n_proxy<boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> >, unsigned char*>::copy_n_and_update (this=0x7f8698264b80) at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/detail/advanced_insert_int.hpp:118
#5 0x00007f869a165fd6 in boost::container::vector<unsigned char, boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::priv_forward_range_insert_expand_backwards<boost::container::container_detail::insert_value_initialized_n_proxy<boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> >, unsigned char*> > (
    this=0x7f85adc00a40, new_start=0x7f85adc165a0 <error: Cannot access memory at address 0x7f85adc165a0>, new_capacity=199624,
    pos=0x7f85adc31974 <error: Cannot access memory at address 0x7f85adc31974>, n=101192, insert_range_proxy=...)
    at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/vector.hpp:2783
#6 0x00007f869a164c0b in boost::container::vector<unsigned char, boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::priv_forward_range_insert_no_capacity<boost::container::container_detail::insert_value_initialized_n_proxy<boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> >, unsigned char*> > (this=0x7f85adc00a40,
    pos=..., n=101192, insert_range_proxy=...) at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/vector.hpp:2265
#7 0x00007f869a1639ec in boost::container::vector<unsigned char, boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::priv_forward_range_insert<boost::container::container_detail::insert_value_initialized_n_proxy<boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> >, unsigned char*> > (this=0x7f85adc00a40, pos=...,
    n=101192, insert_range_proxy=...) at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/vector.hpp:2328
#8 0x00007f869a16241a in boost::container::vector<unsigned char, boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::priv_forward_range_insert_at_end<boost::container::container_detail::insert_value_initialized_n_proxy<boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> >, unsigned char*> > (this=0x7f85adc00a40,
    n=101192, insert_range_proxy=...) at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/vector.hpp:2365
#9 0x00007f869a1604e5 in boost::container::vector<unsigned char, boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::priv_resize<boost::container::value_init_t> (this=0x7f85adc00a40, new_size=178780, u=...) at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/vector.hpp:2151
#10 0x00007f869a15de56 in boost::container::vector<unsigned char, boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::resize (this=0x7f85adc00a40,
    new_size=178780) at /home/jharris/usr/local/boost/include/boost-1_57/boost/container/vector.hpp:1213
#



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