[SNMP4J] SNMP Over TCP Trap Issues

David Allen dallen at mncsoftware.com
Wed Mar 16 20:47:18 CET 2016


Hi -

I am trying to implement a trap handler over TCP and have run into a couple of issues.

The first is that the incoming messages can be much larger than the default returned by getMaxInboundMessageSize. There is a mechanism to set a value in the DefaultTcpTransportMapping, but no way to get the transport mapping that is created when registering a notification listener using Snmp.addNotificationListener. I could create a custom transport mapping that extends the default and register it with the TransportMappings, but I only want to extend the size for this one case - I don't want any other connections to use this extra memory (although I don't think there will be many that use TCP). Is there a way for me to access the transport mapping? Alternatively is there a way to register a CommandResponder with the transport mapping? If there is no current mechanism, would it be worthwhile to create another method on Snmp to return the transport mapping?

The second issue is that it looks like the DefaultTcpTransportMapping will leak SocketEntry objects for a notification listener if the remote connection is closed. I don't see anywhere that the sockets map is cleaned up until the server connection itself is closed. I can see this in both the heap dump and also the debug when the connection is closed and all of the previously connected socket entries are cleaned up. My thought is that the entry should be removed when socketClosedRemotely is invoked.

Thank you,

David



More information about the SNMP4J mailing list