Dear Net-Snmp Team,

We are making use of Net-Snmp library 5.4.1 for embedded development where in 
we are facing one challenge which I would like to share with you.

In order to make snmp work,we have created one thread in which we have called 
agent_check_and_process() with non-blocking mode.We also use 
agent_check_and_proces() in other process, not in same process.


Code snippet
==========

static void snmp_request_daemon(void *arg)
{
    int pcount;
    AC_MU_ERROR m_err;

    for (;;) {
    m_err = ac_mu_lock(daemon_guard, AC_MU_WAIT, 100);
    if (m_err == AC_MU_SUCCESS) {
        pcount = agent_check_and_process(0);
        if (pcount > 0) {
        aci_msg(("handled %d snmp packets", pcount));
        }
        ac_mu_unlock(daemon_guard);       
        ac_t_sleep(10);
    }
    }
}

Problem
======

However the call agent_check_process() is getting struck at snmp_read for some 
reason. Since snmp_read is holding snmp_res_lock and not returning back, all 
other snmp calls (Ex snmp_close()) is blocked on snmp_res_lock. It leads to a 
lockup. 

backtrace at the time of lockup.

=======================

1. Thread struck at snmp_read()


2ab63638 recvmsg+0x80
2c2280cc netsnmp_udp_recv+0x138
2c1f0b54 _sess_read+0x118                
2c1f1d58 snmp_sess_read+0x2C
2c1f1e00 snmp_read+0x64                           (Struck at snmp_read. It is 
waiting to get packets by holding snmp_res_lock)
2c0ee3fc agent_check_and_process+0xD4
005b1090 snmp_request_daemon+0x4C
2ab0e464 wrapperThread+0x168 
2ab5985c start_thread+0x90  
2c409e98 __thread_start+0x28  (dp-bit.c)

2. Thread waiting for the lock.


2ab6177c sem_wait@GLIBC_2.0+0x12C
2c21de4c snmp_res_lock+0x138
2c1e2be4 snmp_close+0x34                 (Snmp_close is waiting for the 
snmp_res_lock).
005adbc8 ac_snmp_get+0x8CC


I would be pleased if you could help me in understanding the reason for 
snmp_read to get blocked.Thanks for listening and reading. I am expecting the 
soon reply from your fantastic team.


Thanks
Jegan

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
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

Reply via email to