Unhandled Exception in AgentX++ !

christel.sohnemann____philips.com christel.sohnemann____philips.com
Fri Mar 22 13:45:54 CET 2002


Hello,

I get an unhandled exception in AgentX++ Layer when sending 2 equal set-requests to the master agent within a very short time (for example 5
seconds).
I debugged the code with "Purify" and I could localize the following Code-Pieces where the behaviour of the AgentX++ seems to be very unstable:

first ist:

int MibLeaf::commit_set_request(Request* req, int ind)
{
      // set the value. set is a wrapper for set_value unless
      // set is overwritten by subclasses
      int status = set(req->get_value(ind));
      if (status != SNMP_ERROR_SUCCESS) {
            return SNMP_ERROR_COMITFAIL;
      }
      // don't send answer until cleanup finished
      Mib::requestList->done(req->get_transaction_id(),
                         ind, req->get_value(ind));

      // notify other classes of change this value
      notify_change(get_oid(), CHANGE);
      return SNMP_ERROR_SUCCESS;
}

and second is:
Here I detected remove = 0. Further on, "request" is still valid, but the PDU object is kind of "rubbish". It is a pointer to something like 0x"aeaeaeae".
That's where - I guess - my program crashes.
So my idea is: is it possible, that 2 concurring threads try to delete the same object?

void AgentXRequestList::answer(Request* req) TS_SYNCHRONIZED(
{
      // CAUTION: Make a copy of PDU here because when we answer
      // the request, the response could be so fast back to our
      // master, that the following request could be processed
      // before we have finished here. In the case of a COMMIT
      // or CLEANUP following a PREPARE_SET this could cause a seg
      // fault because the request were are dealy with here is deleted
      // by the main thread by calling AgentXRequestList::receive!
      //
      AgentXPdu* pdu = new AgentXPdu(*((AgentXPdu*)req->get_pdu()));

      boolean remove = TRUE;
      // check if we need request for further processing
      switch (pdu->get_agentx_type()) {
      case AGENTX_TESTSET_PDU:
      case AGENTX_COMMITSET_PDU:
        remove = FALSE;
        break;
      }
      if (remove)
            requests->remove(req);
      pdu->set_agentx_type(AGENTX_RESPONSE_PDU);
      int status = agentx->send(*pdu);

      if (!remove) {
        // If we do not get a CLEANUP from the master
        // we have to remove the pending request by ourselves.
        ((AgentXRequest*)req)->get_agentx_pdu()->
          set_timestamp(agentx->compute_timeout(AGENTX_DEFAULT_TIMEOUT));
        ((AgentXRequest*)req)->unlock();
      }
      LOG_BEGIN(EVENT_LOG | 4);
      LOG("RequestListAgentX: request answered (id)(status)(tid)(err)(removed)(sz)");
      LOG(pdu->get_request_id());
      LOG(status);
      LOG(pdu->get_transaction_id());
      LOG(pdu->get_error_status());
      LOG(remove);
      LOG(pdu->get_vb_count());
      LOG_END;

      delete pdu;
      if (remove)
            delete req;
})


I am sorry, I cannot send you the complete code I have, as it is just too much and I do not have the time to extract it.
Any help from you is more then welcome, as this is really urgent to us and I am sitting in a kind of "locked room (nothing-disturbes-me-environment)" to fix it.

Thank you very much in advance.

Best regards, Christel


Christel Sohnemann
Software Development
Philips Speech Processing Aachen, Zweigniederlassung der Philips GmbH
Kackertstr. 10, 52072 Aachen, Germany
mailTo: christel.sohnemann____philips.com
Tel:    +49 - (0)241 - 8871 191,    Fax: +49 - (0)241 - 8871 140
http://www.speech.philips.com/




More information about the AGENTPP mailing list