Deadlock when destroying agents in example SingleAgentModule

Bug #616952 reported by Stardom
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenCog
New
Undecided
Unassigned

Bug Description

In the opencog example examples/modules/SingleAgentModule.cc, the destructor calls cogserver.destroyAllAgents().

However, destroyAllAgents was previously called and that function called the agents destructor, both destroyAllAgents attempt to acquire agentsLock. The lock is not recursive so a deadlock results. Here is the backtrace. To replicate this, type the following into the opencog server prompt

loadmodule libsingleagent.so
agents-stop opencog::SingleAgentModule

#0 ~SingleAgentModule (this=0x82d8468, __in_chrg=<value optimized out>) at /home/seth/.rep/misty/SingleAgentModule.cc:65
#1 0xb7f40244 in opencog::safe_deleter<opencog::Agent>::operator() (this=0xbffff40c, __ptr=@0x82d7ce8) at /home/seth/.rep/ochack/opencog/util/misc.h:75
#2 0xb7f3c858 in std::for_each<__gnu_cxx::__normal_iterator<opencog::Agent**, std::vector<opencog::Agent*, std::allocator<opencog::Agent*> > >, opencog::safe_deleter<opencog::Agent> > (__first=..., __last=..., __f=...) at /usr/include/c++/4.4/bits/stl_algo.h:4200
#3 0xb7f37685 in opencog::CogServer::destroyAllAgents (this=0x8072268, id=...) at /home/seth/.rep/ochack/opencog/server/CogServer.cc:314
#4 0xb6048a25 in opencog::BuiltinRequestsModule::do_stopAgents (this=0x8282eb8, dummy=0x82b73e0, args=...) at /home/seth/.rep/ochack/opencog/server/BuiltinRequestsModule.cc:154
#5 0xb604bfc4 in opencog::BuiltinRequestsModule::do_stopAgentsRequest::execute (this=0x82b73e0) at /home/seth/.rep/ochack/opencog/server/BuiltinRequestsModule.h:72
#6 0xb7f36f58 in opencog::CogServer::processRequests (this=0x8072268) at /home/seth/.rep/ochack/opencog/server/CogServer.cc:195
#7 0xb7f36ebe in opencog::CogServer::runLoopStep (this=0x8072268) at /home/seth/.rep/ochack/opencog/server/CogServer.cc:169
#8 0xb7f36dfc in opencog::CogServer::serverLoop (this=0x8072268) at /home/seth/.rep/ochack/opencog/server/CogServer.cc:152
#9 0x0805d71e in main (argc=3, argv=0xbffff944) at /home/seth/.rep/ochack/opencog/server/CogServerMain.cc:193

Revision history for this message
Stardom (seth-tewebs) wrote :

solution, make agentsLock lock recursive?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.