SNMP client code can get stuck in infinite retry loops

Description

With the changes introduced in NMS-8671, it is now possible to configure the retry behavior for various SNMP error status codes.

However, the trackers do not currently limit the number of retry attempts, and if the agent continues to respond with the same error, the client will continue to retry. This can cause bursts of CPU usage and network traffic and prevent certain functions such as a data collection from operating properly.

When performing retries, we should introduce some mechanism to limit the number of retry attempts made.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Benjamin Reed April 5, 2017 at 5:27 PM

PR: https://github.com/OpenNMS/opennms/pull/1422

This passed tests, it's just waiting to deploy.

Jesse White March 1, 2017 at 9:39 AM

With the enhancements from https://opennms.atlassian.net/browse/NMS-9163#icft=NMS-9163, is it possible to reproduce this in a test case with:

$ git diff diff --git a/core/snmp/integration-tests/src/test/java/org/opennms/netmgt/snmp/SnmpTrackerTest.java b/core/snmp/integration-tests/src/test/java/org/opennms/netmgt/snmp/SnmpTrackerTest.java index 3fa1fdb..363c02a 100644 --- a/core/snmp/integration-tests/src/test/java/org/opennms/netmgt/snmp/SnmpTrackerTest.java +++ b/core/snmp/integration-tests/src/test/java/org/opennms/netmgt/snmp/SnmpTrackerTest.java @@ -200,7 +200,13 @@ public class SnmpTrackerTest implements InitializingBean { walk(ct, 10, 3); assertEquals("number of columns returned must match test data", Long.valueOf(6).longValue(), ct.getCount()); } - + + @Test + public void testColumnTrackerWithError() throws Exception { + final CountingColumnTracker ct = new CountingColumnTracker(SnmpObjId.get(".1.3.6.1.3.17")); + walk(ct, 10, 3); + } + @Test public void testTableTrackerWithFullTable() throws Exception { final TestRowCallback rc = new TestRowCallback(); diff --git a/core/snmp/integration-tests/src/test/resources/snmpTestData1.properties b/core/snmp/integration-tests/src/test/resources/snmpTestData1.properties index 6fc8639..7c13754 100644 --- a/core/snmp/integration-tests/src/test/resources/snmpTestData1.properties +++ b/core/snmp/integration-tests/src/test/resources/snmpTestData1.properties @@ -1755,3 +1755,5 @@ .1.3.6.1.2.1.25.5.1.1.2.686 = INTEGER: 0 .1.3.6.1.2.1.25.5.1.1.2.687 = INTEGER: 0 .1.3.6.1.2.1.25.5.1.1.2.717 = INTEGER: 0 +# Fails with SNMP_ERROR_AUTHORIZATION_ERROR +.1.3.6.1.3.17.16 = Responder: org.opennms.mock.snmp.responder.Error
Fixed

Details

Assignee

Reporter

Sprint

Priority

PagerDuty

Created February 28, 2017 at 1:24 PM
Updated April 6, 2017 at 2:56 PM
Resolved April 6, 2017 at 10:56 AM

Flag notifications