Activemq-cpp - Exception is thrown at Threading.cpp:274
I am using activemq-3.9.3 library for c++ on ubuntu 12.x
It is a complex multi threaded application.
I see there are 3000+ application threads got created!
And when I debugged through gdb, I see those threads are depending on one core thread.
The dependency looks like this.
where t1 is waiting for mutex held by t2 and which is waiting for the mutex held by t3. Similary t3 is waiting for t4's resource.
t4's back trace has the following:-
#0 0x00007f18126bbd84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x0000000000e5f226 in (anonymous namespace)::runCallback (arg=0x7f17990f95d0) at decaf/internal/util/concurrent/Threading.cpp:274
#2 0x0000000000e62ed9 in decaf::internal::util::concurrent::PlatformThread::waitOnCondition (condition=0xe5f243, mutex=0x7f179944e5a0, mills=25303968, nanos=47162608) at decaf/internal/util/concurrent/unix/PlatformThread.cpp:197
#3 0x0000000000e62efa in decaf::internal::util::concurrent::PlatformThread::waitOnCondition (condition=0x2cf80a0, mutex=0x2cf5c20, mills=<optimized out>, nanos=<optimized out>)
I also found some of the threads tries to access memory which is corrupted!
I believe this is due to the fact that lot of threads got created and waiting... to unlock the above resource and stack space exhausted!
#10 0x0000000000b9dd16 in boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error> >::~clone_impl (this=0xdf334a, __in_chrg=<optimized out>)
#11 0x0000000000b9d307 in boost::throw_exception<boost::thread_resource_error> (e=...) at /usr/include/boost/throw_exception.hpp:61
9 0x0000000000c4260e in TPGAdaEventReceiver::echoAppletEvent (this=0x0, agentObj=<error reading variable: Cannot access memory at address 0x0>, agentXmlObj=0x0, status=<error reading variable: Cannot access memory at address 0x0>
Please help me to understand
1. What went wrong here? Why the exception is thrown at Threading.cpp:274?
2. How can I fix the same?