[SNMP4J] Safely executing TreeUtils.getSubtree in concurrent threads

Frank Fock fock at agentpp.com
Thu Jun 19 20:30:28 CEST 2014


Hi Nigel,

Your setup is absolutely fine and the recommended one for that task.
Have you checked that the agent isn't the problem?
Agents (except AGENT++ and SNMP4J-Agent based) are often single
threaded and many do not implement thread safe lexicographic ordering
correctly.

Also check the timeout values, because the agent will need more than
twice the time if polled concurrently from two threads (if not 
multi-threaded).

Best regards,
Frank

Am 19.06.2014 19:32, schrieb Nigel Thomas:
> Hi
>
> I have a system with multiple threads getting different SNMP subtrees from
> the same target server concurrently using TreeUtils.getSubtree. One thread
> alone seems to work exactly as expected, but when a second thread starts up
> the two get confused; the first table receives no data.
>
> Clearly I am having some sort of thread safety problem - but with which
> object/method? I am using
> - a singleton instance of Snmp
> - a single instance of CommunityTarget (for each monitored server -
> currently just localhost)
> - therefore a single instance of TransportMapping - a
> DefaultUdpTransportMapping; I have tried
> setAsyncMsgProcessingSupported(true)
> - a separate instance of TreeUtils per thread
> - SNMPv2
> - snmp4j-2.3.0
>
> Any thoughts would be very welcome
>
> TIA
>
> Nigel
> _______________________________________________
> 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