[SNMP4J] Possible bug in exception handling of snmp4j api

Frank Fock fock at agentpp.com
Fri Dec 2 22:18:44 CET 2005


Hi Vinay,

 From my point of view this is not a bug - although it is also not a "good"
feature ;-)
The problem is, that the ReportHandler is called in a different thread than
the original request has been sent from. That's the reason why the exception
is not propagated. Another reason why the exception is not propagated, is
its nature. The exception only occurs, if a message is sent on behalf of an
user that is not known to the USM and if engine ID discovery is enabled and
the target engine ID is not know. So this exception can be avoid by checking
whether the user is known by the USM before sending it.

A possible improvement of the current behavior would be to return a special
report PDU with a SNMP4J specific report object....

Best regards,
Frank

Vinay Patil wrote:

>Hi all,
>
>While communicating with snmp v3, if you specify an incorrect user. 
>
>- MessageDispatcher throws MessageException (user unknown). This exception is caught by ReportProcessor which is not propogated  further.
>- This results in request timeout.
>
>Possible workarounds --
>- Set a ReportHandler on SNMP, but the ReportProcessor uses a semaphore to sync the response and requests. So i guess it won't work.
>- Patch the api by propogating the MessageException wrapped in a RuntimeException (But its very dirty)
>
>Find the stack track of the above mentioned problem ...
>
>---------------------------------------------------------------------------------------------------------------------------------------------------
>1860 [DefaultUDPTransportMapping_138.203.2.103/0] DEBUG 
>org.snmp4j.security.USM  - USM.getUser - User 'WrongUser' unknown
>14:34:00,168 DEBUG USM:Security name not found for 
>engineID=73:6e:6d:70:44:61:65:6d:6f:6e, 
>securityName=57:72:6f:6e:67:55:73:65:72
>1860 [DefaultUDPTransportMapping_138.203.2.103/0] DEBUG 
>org.snmp4j.security.USM  - Security name not found for 
>engineID=73:6e:6d:70:44:61:65:6d:6f:6e, 
>securityName=57:72:6f:6e:67:55:73:65:72
>org.snmp4j.MessageException: Message processing model 3 returned error: 1404
>    at 
>org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:417)
>    at org.snmp4j.Snmp.sendMessage(Snmp.java:940)
>    at org.snmp4j.Snmp$ReportProcessor.processReport(Snmp.java:1224)
>    at org.snmp4j.Snmp.processPdu(Snmp.java:1166)
>    at 
>org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.java:556)
>    at 
>org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.java:262)
>    at 
>org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:323)
>    at 
>org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:284)
>    at 
>org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:81)
>    at 
>org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:279)
>14:34:00,215 ERROR Snmp:Failed to send message to 
>com.alcatel.util.net.snmp.SnmpUserTarget[address=127.0.0.1/2027, 
>version=3, timeout=1000, retries=0]: Message processing model 3 returned 
>error: 1404
>1907 [DefaultUDPTransportMapping_138.203.2.103/0] ERROR org.snmp4j.Snmp  
>- Failed to send message to 
>com.alcatel.util.net.snmp.SnmpUserTarget[address=127.0.0.1/2027, 
>version=3, timeout=1000, retries=0]: Message processing model 3 returned 
>error: 1404
>14:34:00,230  WARN MessageDispatcherImpl:.1.3.6.1.6.3.15.1.1.4.0 = 1
>1922 [DefaultUDPTransportMapping_127.0.0.1/2027] WARN 
>org.snmp4j.MessageDispatcherImpl  - .1.3.6.1.6.3.15.1.1.4.0 = 1
>14:34:13,996 DEBUG Snmp:Request timed out: 1088687094
>
>Would appreciate comments on this problem.
>
>Thanks & Regards,
>Vinay
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/snmp4j
>
>
>  
>


-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com





More information about the SNMP4J mailing list