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

Frank Fock fock at agentpp.com
Wed Oct 26 00:45:22 CEST 2016


Hi Steffen,

Yes, this will be included in the next (2.5.3) release.

Best regards,
Frank

Am 25.10.2016 um 16:09 schrieb Steffen Brüntjen:
> 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




More information about the SNMP4J mailing list