snmp_close on submitted requests

Alasdair McWilliam <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi list :)

I've been troubleshooting something for hours and can't quite put something together.

My app implements the net-snmp async API via the usual snmp_open / snmp_pdu_create / snmp_parse_oid / snmp_add_var / snmp_async_send. I supply a callback to snmp_async_send() and an object containing data that my callback needs to process the result.

In my scenario, I have an open session, and I've submitted a request via that session but it's not coming back. In the normal flow of things, this request times out fine and my callback function is run, and it's passed NETSNMP_CALLBACK_OP_TIMED_OUT. However, in certain circumstances I need to flush my app and force it to dump data into it's backend data store. In these circumstances, I want to effectively "cancel" the pending request as gracefully as possible, and free some objects (namely the data object that's been passed to the SNMP API for callback).

>From what I understand I can just call snmp_close() and any requests waiting are freed up nicely. Looking at the snmp_api.c code, snmp_close() should result in my callbacks being run immediately with NETSNMP_CALLBACK_OP_TIMED_OUT. This is desirable because my app just treats it as an error and flushes the whole request cleanly so I don't have any bad pointers.

The problem I'm having is that when I snmp_close() the sessions, my callback isn't triggering. snmp_close() is returning OK, and it looks like the session is killed OK. However, because the callback isn't triggered, the data object isn't getting dereferenced and I'm ultimately hitting my refcounter logic telling me "you can't free this, it's referenced by something!"

Am I missing something? Perhaps I can't see the wood for the trees?! Or is there a better way to do what I want to achieve without having to ignore my internal refcounting APIs??

SNMP lib version is 5.3.x (RHEL 5) - not had chance to test it against the latest and greatest upstream, but need to target stock RHEL rpms.

Thanks in advance
Al.

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.