[SNMP4J] Problems when running SNMP4j with multiple theads

Sarah Dumoulin sarah.dumoulin at crc.ca
Fri Mar 7 17:12:13 CET 2014


Hello,

  I'm using the SNMP4j library to query several MIBS on our testbed network.  Each MIB is polled at a regular interval in order to keep track of network status.  

  When running with my usual settings (8 threads, each querying once every minute) one or more of the threads will crash after some random length of time.  Sometimes the threads run well for a couple of weeks.  

  Currently, I have a test running where I have twenty threads running each querying a separate device once every two seconds - this is a stress test meant to create problems more frequently so I could track down the error.  This setup will usually have a thread crash after about a day of operation.  The exception reported just before a thread dies is as follows:

java.io.IOException: Wrong ASN.1 type. Not an integer: 0 at position 3^M
        at org.snmp4j.asn1.BER.decodeInteger(BER.java:621)^M
        at org.snmp4j.smi.Integer32.decodeBER(Integer32.java:60)^M
        at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:356)^M
        at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:328)^M
        at org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:76)^M
        at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:404)^M
        at java.lang.Thread.run(Unknown Source)^M

I found a reference to a similar problem here: http://issues.opennms.org/browse/NMS-5395 and followed the reported procedure reported to correct the error (forcing ipV4).  However, this did not solve my problem.  It did produce a different exception though:

java.io.IOException: Data length > 4 bytes are not supported!^M
        at org.snmp4j.asn1.BER.decodeLength(BER.java:528)^M
        at org.snmp4j.asn1.BER.decodeHeader(BER.java:583)^M
        at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:348)^M
        at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:328)^M
        at org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:76)^M
        at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:404)^M
        at java.lang.Thread.run(Unknown Source)^M

I am currently running JVM 1.6 and am unable to upgrade to 1.7 at this time.  Has anyone else had this type of problem occur?  Is there a known fix apart from forcing my threads to perform sequentially rather than in parallel?

Any help would be much appreciated,

Sarah




More information about the SNMP4J mailing list