From what I have seen, when I call finish on a session for PoCo::SNMP I am unable to start a session for that same host again for the life of the program. The first request would work every time without fail but any subsequent requests made after creating a new PoCo::SNMP session for this host would never make the postback. I am now using the hostname the session is for as the alias of the PoCo::SNMP session and detaching the session from the first session that created the session and using the session with that alias if it has already been spawned.

 

I am fine with keeping the PoCo::SNMP session alive throughout the life of the program as every connection that I make will be used frequently so long as it isn’t keeping other sessions alive without cause. With PoCo::SNMP using a postback that is passed along in the anonymous sub used as the callback (which is referenced permanently in the Net::SNMP session) however, it will keep the calling session alive until a call is made from another session or the finish is called. I believe I have a fix for this problem by simply adding a line to the anonymous sub that sets the postback reference to undef after calling the postback. I haven’t seen any side effects from making this change but wanted to bring it up on this list to make sure that I am not missing something important and to include the patch in the case that this is a useful change. Any comments on this would be greatly appreciated and I hope that this patch is useful.

 

- Kenny Flegal

Attachment: poco_snmp_postback_patch.diff
Description: poco_snmp_postback_patch.diff

Reply via email to