[SNMP4J] TableUtils - GetBulk responses - Possible race condition
Damian
damianstaro at hotmail.com
Tue Mar 18 23:24:03 CET 2008
Frank,
My tests have now passed after the patch.
Thanks for the quick response,
Damian
--------------------------------------------------
From: "Frank Fock" <fock at agentpp.com>
Sent: Tuesday, March 18, 2008 5:20 PM
To: "Damian" <damianstaro at hotmail.com>
Cc: <snmp4j at agentpp.org>; <damian at airdefense.net>
Subject: Re: [SNMP4J] TableUtils - GetBulk responses - Possible race
condition
> Hi Damian,
>
> Sorry, I introduced a new bug here. To fix that one
> please apply the following patch:
>
> Index: Snmp.java
> ===================================================================
> --- Snmp.java (revision 400)
> +++ Snmp.java (working copy)
> @@ -1117,15 +1117,17 @@
> synchronized (pendingRequests) {
> request = (PendingRequest) pendingRequests.get(handle);
> if (request != null) {
> - request.responseReceived();
> - }
> - else if (request.isResponseReceived()) {
> - pendingRequests.remove(handle);
> - request = null;
> - if (logger.isInfoEnabled()) {
> - logger.info("Received second response for request with handle
> "+
> - handle);
> + if (request.isResponseReceived()) {
> + pendingRequests.remove(handle);
> + request = null;
> + if (logger.isInfoEnabled()) {
> + logger.info("Received second response for request with
> handle "+
> + handle);
> + }
> }
> + else {
> + request.responseReceived();
> + }
> }
> }
> if (request == null) {
>
> Best regards,
> Frank
>
> Damian wrote:
>> Hi Frank,
>>
>> I tried SNMP4J_20080318_033301_snapshot.zip to try to validate the fix
>> and I am getting the following exception now:
>>
>> java.lang.NullPointerException
>> at org.snmp4j.Snmp.processPdu(Snmp.java:1122)
>> at
>> org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.java:606)
>> at
>> org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.java:287)
>> at
>> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:347)
>> at
>> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:309)
>> at
>> org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:83)
>> at
>> org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:328)
>> at java.lang.Thread.run(Thread.java:619)
>> at
>> org.snmp4j.util.DefaultThreadFactory$WorkerThread.run(DefaultThreadFactory.java:65)
>> Let me know if you need any additional info.
>>
>> Thanks,
>> Damian
>
> --
> AGENT++
> http://www.agentpp.com
> http://www.mibexplorer.com
> http://www.mibdesigner.com
>
More information about the SNMP4J
mailing list