You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Pietrowicz, Stephen R" <sr...@illinois.edu> on 2016/07/21 22:01:40 UTC

DEFAULT_NAME_PREFIX deallocated prematurely

Hi,

I’m not sure how to approach fixing this.   We have a very large code base which makes it tough to post test here that can be reproduced easily on other systems, otherwise I’d do it.  I’m posting this here in case someone else as run across this issue:


We’re getting a seg fault when the SWIG-ed C++ code we’re working with is exiting.  We’re seeing the destructor for DEFAULT_NAME_PREFIX (in decaf/util/concurrent/Mutex.cpp) being called by _run_exit_handlers() in exit.c, and then later that string is attempted to be accessed by a pthread from decaf.

Here’s what I was able to catch in the gdb:


----

(gdb) c


Continuing.





Breakpoint 14, decaf::util::concurrent::Mutex::Mutex (this=0x7fff9509dc80) at decaf/util/concurrent/Mutex.cpp:50


50                  this->name.reserve(DEFAULT_NAME_PREFIX.length() + idStr.length());


(gdb) print DEFAULT_NAME_PREFIX


$136 = "Mutex-"


(gdb) c


Continuing.


[Switching to Thread 0x7ffff7bf7700 (LWP 1256187)]





Breakpoint 15, std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7fff9c3649f0 <decaf::util::concurrent::MutexProperties::DEFAULT_NAME_PREFIX>,


    __in_chrg=<optimized out>) at /usr/src/debug/gcc-4.4.7-20120601/obj-x86_64-redhat-linux/x86_64-redhat-linux/libstdc++-v3/include/bits/basic_string.h:502


502           ~basic_string()


(gdb) print *this


$137 = "Mutex-"


(gdb) bt


#0  std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7fff9c3649f0 <decaf::util::concurrent::MutexProperties::DEFAULT_NAME_PREFIX>, __in_chrg=<optimized out>)


    at /usr/src/debug/gcc-4.4.7-20120601/obj-x86_64-redhat-linux/x86_64-redhat-linux/libstdc++-v3/include/bits/basic_string.h:502


#1  0x00000036fba35ae2 in __run_exit_handlers (status=0, listp=<optimized out>, run_list_atexit=<optimized out>) at exit.c:78


#2  *__GI_exit (status=0) at exit.c:100


#3  0x00000036fba1ed24 in __libc_start_main (main=0x400710 <main>, argc=2, ubp_av=0x7fffffffc618, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffc608)


    at libc-start.c:258


#4  0x0000000000400649 in _start ()


(gdb) c


Continuing.


[Switching to Thread 0x7fff9509e700 (LWP 1256247)]





Breakpoint 14, decaf::util::concurrent::Mutex::Mutex (this=0x7fff9509dc80) at decaf/util/concurrent/Mutex.cpp:50


50                  this->name.reserve(DEFAULT_NAME_PREFIX.length() + idStr.length());


(gdb) print *this


$138 = {monitor = 0x0, name = "", static id = 152,


  static DEFAULT_NAME_PREFIX = "Mutex-\000{XDigit}+!\000\000\000\000\000\000\000ios_base_dec\000\000\000\000 \000\000\000\000\000\000\000\321\000\000\000\000\000\000\000b\000\000\000\000\000\000\000\254", '\000' <repeats 13 times>, "\001\000[\\x00-\\x20]*([+-]?)0[xX](\\p{XDigit}+\\.?|\\p{XDigit}*\\.\\p{XDigit}+)[pP]([+-]?\\d+)[fFdD]?[\\x00-\\x20]*\000st/ctrl/events/events<smb://x00-//x20]*([+-]?)0[xX](//p{XDigit}+//.?|//p{XDigit}*//.//p{XDigit}+)[pP]([+-]?//d+)[fFdD]?[//x00-//x20]*/000st/ctrl/events/events>"...}


(gdb) bt


#0  decaf::util::concurrent::Mutex::Mutex (this=0x7fff9509dc80) at decaf/util/concurrent/Mutex.cpp:50


#1  0x00007fff9bd3fcbe in AbstractCollection (this=0x7fff9509dc78, __vtt_parm=0x7fff9c341d58 <VTT for decaf::util::LinkedList<decaf::util::concurrent::ExecutorKernel::Worker*>+56>, __in_chrg=<optimized out>)


    at ./decaf/util/AbstractCollection.h:65


#2  AbstractList (__vtt_parm=0x7fff9c341d30 <VTT for decaf::util::LinkedList<decaf::util::concurrent::ExecutorKernel::Worker*>+16>, this=0x7fff9509dc70, __in_chrg=<optimized out>)


    at ./decaf/util/AbstractList.h:341


#3  AbstractSequentialList (this=0x7fff9509dc70, __vtt_parm=0x7fff9c341d28 <VTT for decaf::util::LinkedList<decaf::util::concurrent::ExecutorKernel::Worker*>+8>, __in_chrg=<optimized out>)


    at ./decaf/util/AbstractSequentialList.h:59


#4  LinkedList (this=0x7fff9509dc70, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at ./decaf/util/LinkedList.h:91


#5  decaf::util::concurrent::ExecutorKernel::WorkerKiller::run (this=0xb0fda0) at decaf/util/concurrent/ThreadPoolExecutor.cpp:248


#6  0x00007fff9bd2aa22 in decaf::util::TimerImpl::run (this=0xb0e450) at decaf/util/Timer.cpp:156


#7  0x00007fff9bca9a8f in (anonymous namespace)::runCallback (arg=<optimized out>) at decaf/internal/util/concurrent/Threading.cpp:268


#8  0x00007fff9bca9804 in (anonymous namespace)::threadEntryMethod (arg=0xb0ecc0) at decaf/internal/util/concurrent/Threading.cpp:256


#9  0x00000036fc607aa1 in start_thread (arg=0x7fff9509e700) at pthread_create.c:301


#10 0x00000036fbae8aad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115


(gdb)