I wrote up a "bug" under AGENTX for this.
My system:
Net-SNMP 5.2.1

The abbreviated problem description:
I have seen cases recently where my application where I manage the FDs
(by first getting FDs from NET-SNMP via snmp_select_info()) will select
events on 2 FDs. The first event will cause me to call snmp_timeout()
and run_alarms() to check to timeouts or something to do as an alarm.
This event will cause AGENTX to send a ping which it expects a
synchronous response. It will select on the SNMP file descriptors on
its own and read from one that is active. The problem is that this
first event causes the second event to be consumed but inside the first
event instead of the second. Then when the second event is processed,
there is nothing to read from the FD anymore (first event stole it) and
now the application hangs on recv().

This all happens because the first event (that runs run_alarms() and
agentx ping) calls send(), select(), and recv() all in the same function
call (agentx_synch_response()).

It seems to me that it shouldn't be calling select() or recv(). I
realize it was designed to do this, but it seems wrong to do this. The
send() would be OK, but then the code should wait for until the FD
manager (which may be the user's application) select()s "read" to
process the response to the send().

I guess I would like to understand if the AGENTX protocol really
requires an synchronous response or if waiting for the response
asynchronously would be OK as well. Obviously to make this happen there
would be code changes required, but I guess I would like to understand
if it is even feasible or if this is even thought of as a "bug". I
think it is working as designed, but the design limits the users ability
to make an asynchronous application using NET-SNMP and as I found can
cause a hang condition.

More detail in the bug report.


Sten J. Olsson
Software Engineer
Lockheed Martin TSS
9211 Corporate Blvd. Bldg. 870/2F05
Rockville, MD 20850

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Net-snmp-coders mailing list