[AGENT++] recvfrom's blocking and process grinding to a halt

John McCaskey jmccaskey at gmail.com
Wed Mar 22 17:17:10 CET 2006


Everyone,

As those of you who have been following my posts know I have SNMP++ embedded
into a multi-threaded polling engine.  I've already made some modifications
to allow multiple v3MP objects (one per thread), and I've been able to get
the v3 performance both thread safe and fast thanks to some suggestions from
Frank and Jochen.

However, I am now sometimes experience a situation where the process begins
thrashing my CPU's and grinds to a halt.  If I run the debugger on the
process when this occurs I seem to find that many threads are blocked in
recvfrom calls.  My situation when this happens is that I am trying to
stress test the polling engine by having it poll about 3000 devices using 80
seperate threads.  Since I don't really have 3000 devices for testing I have
setup linux servers with a software agent and I am polling each of them
several hundred times.  Is it possible that there is then some sort of race
condition where after doing the select and seeing data is available from the
remote address there is a context switch and a recvfrom call in another
thread is then receiving the data that the other thread thought was
available?  Then when the context switchs back the first thread trys to
recvfrom (having already selected) but the data is gone and it blocks?  I've
just initially started looking into this and I'm not sure if that even makes
sense in the way the IO works in SNMP++, but any thoughts, suggestions, or
other insight would be appreciated!

Thanks,

John McCaskey



More information about the AGENTPP mailing list