[AGENT++] RE: Sub agent, AgentX, core dump - related to shared table row removal

Frank Fock fock at agentpp.com
Tue May 20 23:13:25 CEST 2008


Hello John,

Sorry for the late response, I have just missed your
posting (too much traffic...)
My previous posting was not correct regarding your
particular problem. When removing a row, you need
the mib->lock_mib() mutex to avoid concurrent threads
entering into the table row to delete. Thus, the code
should look like:

  mib->lock_mib();
  table->start_synch();
  table->remove_row(index);     (or table->allocate_index(index);)
  table->end_synch();
  mib->unlock_mib();

Best regards,
Frank

john.edmonds at bt.com wrote:
> Hello,
>  
> I have received no reply to this, and earlier e-mails, have you had a chance to review them?
>  
> Best regards,
> John Edmonds
> 
> ________________________________
> 
> From: Edmonds,J,John,JGFTX C
> Sent: Mon 12/05/2008 13:47
> To: agentpp at agentpp.org
> Subject: Sub agent, AgentX, core dump - related to shared table row removal
> 
> 
> I am still experiencing core dumps related to shared table row removal.  
> I have implemented 
>  
> mib->lock_mib();
> table->start_synch();
> mib->unlock_mib();
> table->remove_row(index);     (or table->allocate_index(index);)
> table->end_synch();
> 
> to synchronise row removal.  The core dumps are less frequent with this code in place, but still prevent us from being able to deploy the AgentX code.  The stack backtrace for the core dump with the above synch code in place is as follows:
>  
> #7 thread_starter () at threads.cpp:486
> #6 Agentpp::TaskManager::run () at threads.cpp:742
> #5 Agentpp::MibTask::run () at threads.cpp:920
> #4 Agentpp::SubAgentXMib::do_process_request () at agent_subagent.cpp:1030
> #3 Agentpp::ThreadPool::execute () at threads.cpp:805
> #2 Agentpp::Synchronised::wait () at threads.cpp:301
> #1 pthread_cond_timedwait_relative () at queue.h:27
> #0 __pthread_cond_signal () at condvar.c:267
>  
>  
> I notice in the example, subagent.cpp, there is a suggestion that the call to remove_row() is coded such that mib->process_request() and ifTable->remove_row() can't be executing at the same time, as they would be on the same thread.  Do I need to modify my implementation to mimic this?
>  
> From the subagent.cpp example...
>  
> Request* req;
> while ((run) && (!mib->get_agentx()->quit())) {
>  
> req = reqList->receive(20000);
> if (req) {
> mib->process_request(req);
> }
> else {
> // ping the master
> mib->ping_master();
> // we add or remove here rows 
> /* This shows how manipulation of a shared
> table can be done from outside the table class:
> if (ifTable->size() < 3) {
> ifTable->any_index();
> }
> else {
> List<MibTableRow>* l = ifTable->get_rows();
> Oidx ind(l->last()->get_index());
> l->clear();
> delete l;
> ifTable->remove_row(ind);
> }
> */
> }
> }
> For your reference the software versions we are currently running are:
>  agent++ v3.5.27.b
>  agentX++ v1.4.15
>  snmp++ v3.2.21.a
> Would there be any benefit in upgrading from these versions with regards to this problem?
> 
> Regards,
> John Edmonds (BT)
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com



More information about the AGENTPP mailing list