From bruno.hergott at thalesgroup.com Wed Jun 22 04:21:42 2022 From: bruno.hergott at thalesgroup.com (HERGOTT Bruno) Date: Wed, 22 Jun 2022 09:21:42 +0000 Subject: [ace-bugs] [ASNMP]: asynchronous get will loop / burst affecting CPU and network in a specific scenario Message-ID: <0a06772f388141079c3a0f7dd79690ef@thalesgroup.com> 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: