[AGENT++] Potential deadlocks for SNMP Subagents ...

Jens Engel Jens.Engel at marconi.com
Tue May 17 17:19:11 CEST 2005


APPLIES-TO: SNMP Subagents (connected via AgentX)
IN:  file:agentx_subagent.cpp (AgentX++ v1.4.11)
NOTE: Problematic lines marked with "XXX".

1. SubAgentXMib::find_next(): If logging is more verbose (DEADLOCK OCCURs):

int SubAgentXMib::find_next(MibContext* context, const Oidx& oid,
MibEntryPtr& entry, Request* req, const int reqind)
{
      int err = Mib::find_next(context, oid, entry, req, reqind);
      if (err == SNMP_ERROR_SUCCESS) {
            ...
            // test for valid range
            if (range.get_lower() <= range.get_upper()) {
                  if (!is_complex_node(entry)) {
                    if (!range.includes(*entry->key()))
                        return sNMP_SYNTAX_NOSUCHOBJECT;
                  }
                  else {
                          LOG_BEGIN(DEBUG_LOG | 3);
                    LOG("SubAgentXMib: find next
(lower)(upper)(incl)(succ)");
                    LOG(range.get_lower().get_printable());
                    LOG(range.get_upper().get_printable());
                    LOG((range.is_lower_included()) ? "TRUE":"FALSE");
XXX                 // XXX-JE-PATCH: NO; find_succ locks thread => deadlock
!!
XXX                 // LOG(entry->find_succ(oid, req).get_printable());
                    LOG_END;

2. In process_response(): Missing queue->unlock()??? (by Inspection)

void SubAgentXMib::process_response(AgentXRequest* r)
{
      ...
      queue->lock();
      ...
      if (!pending) {
            ...
XXX         queue->unlock();  //< XXX-JE-PATCH: Is this not missing here
(before return)???
            return;
     ...
}

Jens Engel, EG/FW-BTC4, Marconi Communications GmbH.
Tel. ++49 7191 13-4702
mailto:Jens.Engel at marconi.com





More information about the AGENTPP mailing list