[ace-bugs] [ASNMP]: asynchronous get will loop / burst affecting CPU and network in a specific scenario

HERGOTT Bruno bruno.hergott at thalesgroup.com
Wed Jun 22 04:21:42 CDT 2022


ACE VERSION: 6.2 (probably same thing for newer ACE Versions as the asnmp code has no functional change)
HOST MACHINE and OPERATING SYSTEM: PC with Windows XP

Config.h : #include "ace/config-win32.h"


Microsoft Visual C++


No $ACE_ROOT/bin/MakeProjectCreator/config/default.features file

ASNMP\snmp affected


THE PROBLEM AFFECT: EXECUTION


SYNOPSIS:
asynchronous get (use of Snmp::get( Pdu &pdu, UdpTarget &target, Snmp_Result * cb)
will loop / burst affecting CPU and network in a specific scenario


DESCRIPTION:
Usually, a simple call to Snmp::get( Pdu &pdu, UdpTarget &target, Snmp_Result * cb) will be OK
But if you use it with a polling (for exemple call each 5s) and you several times disconnect/reconnect network during one minute it can go into trouble.
In Snmp::result you will have rc == SNMP_CLASS_TIMEOUT, and in this case we must not check pdu_->get_request_id() because this pdu_ won't be updated
This (pdu_->get_request_id() == hold_req_id_) check will be False, so the transaction is run, again, and again.. Doing network / CPU burst
I have done the following workaround for this :
void Snmp::result(transaction *t, int rc)
{
    t->result(*pdu_);
    // verify this is the pdu we are after, except that a result with rc SNMP_CLASS_TIMEOUT or SNMP_CLASS_RESOURCE_UNAVAIL
      // are special cases build by ASNMP lib in transaction::handle_timeout/handle_input:
      // in these cases we must not check pdu_->get_request_id() because this pdu_ won't be updated
    if ((rc == SNMP_CLASS_TIMEOUT) || (rc == SNMP_CLASS_RESOURCE_UNAVAIL)
            || (pdu_->get_request_id() == hold_req_id_))
    {...




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/ace-bugs/attachments/20220622/dd762b1f/attachment.html>


More information about the ace-bugs mailing list