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

Jochen Katz katz at agentpp.com
Wed Mar 22 22:56:41 CET 2006


Hi John,

>> the debugger on the process when this occurs I seem to find that 
>> many threads are blocked in recvfrom calls.

recvfrom is called only from receive_snmp_response() which is only
called from CSNMPMessageQueue::HandleEvents(), HandleEvents is only
called from EventListHolder::SNMPProcessPendingEvents(). In this
function the pevents_mutex synchronizes the calls

m_eventList.GetFdSets()
select()
HandleEvents()

So if a response is coming in GetFdSets returns the fd, select marks it
as receivable and HanldeEvents calls recvfrom.

So I see no reason why recvfrom on a fd with no data is called.


>> 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?



More information about the AGENTPP mailing list