Hi Everyone,

I am relatively new to snmp itself and I'm curretly using net-snmp 5.7.1.
With my current project, I have experienced several deadlocks when trying
to do MIB walk.

Several days of debugging, I have arrived at the following flow that causes
the dealock:

In function snmp_read2 of snmp_api.c, there's snmp_res_lock(MT_LIBRARY_ID,
MT_LIB_SESSION) call,
then it calls _sess_read, then _sess_read calls _sess_process_packet, and
inside _sess_process_packet there's
sp->callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE, sp, pdu->reqid, pdu,
sp->callback_magic) call,
which I believe it calls handle_agentx_packet of agentx/subagent.c. Inside
handle_agentx_packet, there's a call to snmp_async_send, it then calls
snmp_sess_pointer, but there's another snmp_res_lock(MT_LIBRARY_ID,
MT_LIB_SESSION) call inside snmp_sess_pointer, so it never completes
because the thread has been locked previously on snmp_read2.

Flow:
snmp_sess_read2  ...snmp_res_lock session... -->  _sess_read -->
_sess_process_packet -->  sp->callback() --> handle_agentx_packet -->
snmp_async_send --> snmp_sess_pointer ...snmp_res_lock session... -->
deadlock

Is there already a fix for this?, or Is there anything that I should do to
prevent this from happening?

Thanks very much in advance.


Warm regards,

Amir
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to