[multi_index] SIGABRT in multi_index_container constructor

Hi,
Im defining a class with a multi_index_container as base. When i construct a
instance of this class, and the multi_index_container is called, the
program crashes. It even crashes, when i dont use it as a base class.
Like this:
struct query
{
query(unsigned int id_,
unsigned short pr_,
unsigned short type_,
unsigned short status_);
virtual ~query();
enum estatus{WAITING=0, WORKING=1, BUFFERED=2};
unsigned int id;
unsigned short pr;
unsigned short type;
unsigned short status;
typedef boost::shared_ptr<query> pointer;
};
struct query_rank_key:composite_key<
query::pointer,
member
{};
typedef multi_index_container<
query::pointer,
indexed_by<
ordered_non_unique<
query_rank_key
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
,composite_key_result_less
queue_set;
class queue : public queue_set
{
public:
queue(){};
virtual ~queue(){};
typedef boost::shared_ptr<queue> pointer;
};
This compiles just fine, but if i run the code i get the following backtrace
after a Sigmentation Abort.
It happens, when the queue::queue() is called. Someone a idee whats it
about? Im new to boost::multi_index, so maybe i misunderstud something?
Thank you
Manuel Jung
Ps.: boost 1.33.1, g++ 4.0
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7a1b770 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7a1cef3 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb7a14dbb in __assert_fail () from /lib/tls/i686/cmov/libc.so.6
#4 0xb7b2d591 in pthread_mutex_lock ()
from /lib/tls/i686/cmov/libpthread.so.0
#5 0x080809ab in scoped_lock (this=0xbff658f8, m=@0x80f15cc)
at /usr/local/include/boost/detail/lwm_pthreads.hpp:72
#6 0x08080a2c in boost::multi_index::detail::safe_iterator_base::detach (
this=0xbff659c0)
at /usr/local/include/boost/multi_index/detail/safe_mode.hpp:202
#7 0x08080bfd in ~safe_iterator_base (this=0xbff659c0)
at /usr/local/include/boost/multi_index/detail/safe_mode.hpp:127
#8 0x08085f9d in ~safe_iterator (this=0xbff659c0)
at /usr/local/include/boost/multi_index/detail/safe_mode.hpp:217
#9 0x08085fc1 in ~index_iterator (this=0xbff659c0)
at /usr/local/include/boost/multi_index/detail/index_iterator.hpp:72
#10 0x0808a7a5 in
boost::multi_index::detail::ordered_index

Hello Manuel,
----- Mensaje original -----
De: Manuel Jung
Hi,
Im defining a class with a multi_index_container as base. When i construct a instance of this class, and the multi_index_container is called, the program crashes. It even crashes, when i dont use it as a base class. [...] This compiles just fine, but if i run the code i get the following backtrace after a Sigmentation Abort. It happens, when the queue::queue() is called. Someone a idee whats it about? Im new to boost::multi_index, so maybe i misunderstud something? Thank you
Well, what you're doing is AFAICS correct, so you shouldn't be getting this crash. You haven't provided a complete test program showing producing the crash, so I wrote one myself after what you've shown and tried it locally, no problems here. Could you please try the attached jung.cpp file? Does it crash also? If it doesn't then there's more to your program than you have described, maybe you can send compilable program showing the issue. If jung.cpp crashes, then could you please provide the following info? 1. What system are you running this on? 2. The stacktrace mentions a failed assertion in libc.so. Can you see the source code that's causing the assertion? Maybe it sheds some light. 3. Can you try the attached lock.cpp file? Crash/no crash? Looking forward to your response, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Hello Manuel,
Hi,
Im defining a class with a multi_index_container as base. When i construct a instance of this class, and the multi_index_container is called, the program crashes. It even crashes, when i dont use it as a base class. [...] This compiles just fine, but if i run the code i get the following backtrace after a Sigmentation Abort. It happens, when the queue::queue() is called. Someone a idee whats it about? Im new to boost::multi_index, so maybe i misunderstud something? Thank you
Well, what you're doing is AFAICS correct, so you shouldn't be getting this crash. You haven't provided a complete test program showing producing the crash, so I wrote one myself after what you've shown and tried it locally, no problems here. Could you please try the attached jung.cpp file? Does it crash also? If it doesn't then there's more to your program than you have described, maybe you can send compilable program showing the issue. If jung.cpp crashes, then could you please provide the following info?
1. What system are you running this on? 2. The stacktrace mentions a failed assertion in libc.so. Can you see the source code that's causing the assertion? Maybe it sheds some light. 3. Can you try the attached lock.cpp file? Crash/no crash?
Looking forward to your response,
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Hi, your test file jung.cpp runs just fine on my server (i tested the original program on a kubuntu 6.10 machine and a debian 3.1 server. I will now review the source code and try a failing source code. But there is not really much that i can change, there are only some other class constrtuctors around these. More later, cause im at work at the moment.. Greetings Manuel Jung
participants (2)
-
"JOAQUIN LOPEZ MU?Z"
-
Manuel Jung