[SNMP4J] Possible bug in exception handling of snmp4j api

Vinay Patil Ramesh.patil.vinay1 at telenet.be
Thu Dec 1 19:28:08 CET 2005


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


More information about the SNMP4J mailing list