This forum has been archived. Please start a new discussion on GitHub.

IceUtil::Thread::run(): terminate called recursively Cond.cpp


I am using Ice 3.2.1 on FreeBSD.

I am getting following error:
IceUtil::Thread::run(): uncaught exception: terminate called recursively Cond.cpp
Backtrace is as follows:
#0  0x284de537 in pthread_testcancel () from /lib/
#1  0x284cd89a in sigaction () from /lib/
#2  0x284c788d in pthread_kill () from /lib/
#3  0x284c7256 in raise () from /lib/
#4  0x285a0b78 in abort () from /lib/
#5  0x2843c30f in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/
#6  0x2844049c in __cxxabiv1::__terminate () from /usr/lib/
#7  0x284404d4 in std::terminate () from /usr/lib/
#8  0x28481d4d in __cxa_get_globals () from /usr/lib/
#9  0x28440346 in __cxa_current_exception_type () from /usr/lib/
#10 0x2843c1e6 in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/
#11 0x2844049c in __cxxabiv1::__terminate () from /usr/lib/
#12 0x284404d4 in std::terminate () from /usr/lib/
#13 0x28481d4d in __cxa_get_globals () from /usr/lib/
#14 0x28440409 in __cxa_throw () from /usr/lib/
#15 0x282c0822 in IceUtil::Cond::Cond () from /usr/local/lib/
#16 0x08051d42 in Monitor (this=0x28063fc0) at Monitor.h:78
#17 0x08050c06 in Job (this=0x28063fc0, data=@0xbf7fcf40, type=1) at ./../src/job.cpp:10
#18 0x08058637 in ProxyPutAdapter::run (this=0x807b340) at proxy_put_adapter.cpp:28
#19 0x282db04d in startHook () from /usr/local/lib/
#20 0x284cf3a5 in pthread_create () from /lib/
#21 0x2858c137 in _ctx_start () from /lib/

I am running few test cases on individual components of my application. Therefore, in above component, there is no Ice messaging except Monitor and Threads from IceUtil.

The above exception is occuring when I slow down my application by printing high frequency of debug information ( cout<<" SOme debug ..."<<flush; ).

Code snippet as follows:
	for(int i=1;i<=100000;i++) {
		while(true) {
                        //Job is sub-class of IceUtil::Monitor<IceUtil::Mutex>
			Job *data = new Job("xxx", DB_PUT);   //proxy_put_adapter.cpp:28
			try {
                                //Following put operation is where I print some debug information.
                                //If I reduce the debug info frequency, exception does not occur at line 28, above.
				smart_queue_->put(data, DB_PUT);
			} catch(...) {

I hope, my problem is clear from this post. I can provide you will full component code, if required.

I am not sure, but I suspect, my problem could be somewhat related to reasons similar to this post.



  • benoit
    benoit Rennes, France

    You should catch the exception and print it out so that we can figure out why the condition variable of the IceUtil::Monitor can't be created:
        Job *data = new Job("xxx", DB_PUT);
    catch(const IceUtil::Exception& ex)
        cerr << ex << endl;

    Is the Job object correctly released? If not, it's likely that your process is running out of system resources.

  • Thanks Benoit.

    Yes, its certainly a system getting out of resource problem.

    Garbage collection fixed the problem.

    Apologise for posting message before proper investigation.