[SNMP4J] TableUtils.getTable() doesn't return

Steffen Brüntjen Steffen.Bruentjen at macmon.eu
Tue Oct 25 16:09:52 CEST 2016


Hi!

I can approve that this edit

		boolean sentChunk = sendNextChunk();
		if (!sentChunk) {
			if (anyMatch) {
				sent = 0;
				anyMatch = false;
				sentChunk = sendNextChunk();
			}
			if (!sentChunk) {
				emptyCache();
				finished = true;
				listener.finished(new TableEvent(this, userObject));
			}
		}

solves the problem. Are you going to merge this to the next release?

The device with this issue is an HP ProCurve Switch 2910al-48G (J9147A).

Best regards,
Steffen Brüntjen 



-----Original Message-----
From: SNMP4J [mailto:snmp4j-bounces at agentpp.org] On Behalf Of Frank Fock
Sent: Dienstag, 25. Oktober 2016 02:03
To: snmp4j at agentpp.org
Subject: Re: [SNMP4J] TableUtils.getTable() doesn't return

Hi Steffen,

I cannot imagine a standard conforming agent that will cause the 
situation you
described, but anyway you are right, that there is a "hole" in the 
algorithm of
TableUtils.

To fix it, you can replace the "relevant part in 
TableRequest.onResponse" with

boolean sentChunk;
if (!(sentChunk = sendNextChunk())) {
   if (anyMatch) {
     sent =0;
     anyMatch =false;
     sentChunk = sendNextChunk();
   }
   if (!sentChunk) {
     emptyCache();
     finished =true;
     listener.finished(new TableEvent(this,userObject));
   }
}

Best regards,
Frank


Am 24.10.2016 um 18:36 schrieb Steffen Brüntjen:
> Hi!
>
> I found a problem in the TableUtils class. I set maxNumColumnsPerPDU in my
> TableUtils object to 1 (because one of the test devices returns results in
> wrong lexicographic order). Then, in some cases the TableUtils method
>
> 		public List<TableEvent> getTable(Target target,
> 					OID[] columnOIDs,
> 					OID lowerBoundIndex,
> 					OID upperBoundIndex) {
>
> doesn't return. It starts waiting for a notify() on InternalTableListener
> which never comes.
>
> This is the relevant part in TableRequest.onResponse:
>
> 		if (!sendNextChunk()) {
> 			if (anyMatch) {
> 				sent = 0;
> 				anyMatch = false;
> 				sendNextChunk();
> 			} else {
> 				emptyCache();
> 				finished = true;
> 				listener.finished(new TableEvent(this, userObject));
> 			}
> 		}
>
> The problem arises when the second call of sendNextChunk() returns false.
> And this is what's happening. In sendNextChunk(), the first false comes
> from here:
>
> 		if (sent >= lastReceived.size()) {
> 			return false;
> 		}
>
> The second false comes from here:
>
> 		sent += chunkSize;
> 		if (pdu.size() == 0) {
> 			return false;
> 		}
> 		sendRequest(pdu, target, sentColumns);
>
>
> Best regards,
> Steffen Brüntjen
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231

_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j


More information about the SNMP4J mailing list