(unknown)
"Harendra Pratap Singh" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Dave,
I have written a subagent. Sometimes which works fine but sometimes it
stucks and snmpwalk returns with time out. I have taken the back trace
of stack when it works fine and when it does not work fine as below. I
am using net-snmp code.
When it works find
Thread 6 (Thread 0x7f491b0bd950 (LWP 19287)):
#0 0x00007f4918eab642 in select () from /lib64/libc.so.6
#1 0x000000000044abe3 in GisSnmpThreadProcedure (arg=0x0) at
gis_snmp.c:82
#2 0x00000000004d63c1 in ThreadFn (arg1=0xec8790) at
/repos/harendra/iserver_6_0_0_0_d18/common/thutils.c:285
#3 0x00007f4919f14070 in start_thread () from /lib64/libpthread.so.0
#4 0x00007f4918eb20ed in clone () from /lib64/libc.so.6
#5 0x0000000000000000 in ?? ()
When it gets stuck
Thread 6 (Thread 0x7f4f6940b950 (LWP 17138)):
#0 0x00007f4f6826887b in read () from /lib64/libpthread.so.0
#1 0x000000000056b280 in netsnmp_callback_recv (t=<value optimized
out>, buf=<value optimized out>, size=<value optimized out>,
opaque=0x7f4f6940a6f8,
olength=0x7f4f6940a704) at snmpCallbackDomain.c:194
#2 0x0000000000542447 in _sess_read (sessp=0xeec760,
fdset=0x7f4f6940abd0) at snmp_api.c:5544
#3 0x00000000005431e9 in snmp_sess_read (sessp=0xb,
fdset=0x7f4f6940a69f) at snmp_api.c:5761
#4 0x0000000000543223 in snmp_read (fdset=0x7f4f6940abd0) at
snmp_api.c:5378
#5 0x00000000004ede02 in nx_subagent_agentx_process
(read_setp=0x7f4f6940abd0) at
/repos/harendra/iserver_6_0_0_0_d18/common/nx_subagent.c:103
#6 0x000000000044abef in GisSnmpThreadProcedure (arg=0x0) at
gis_snmp.c:88
#7 0x00000000004d63c1 in ThreadFn (arg1=0xec8790) at
/repos/harendra/iserver_6_0_0_0_d18/common/thutils.c:285
#8 0x00007f4f68262070 in start_thread () from /lib64/libpthread.so.0
#9 0x00007f4f672000ed in clone () from /lib64/libc.so.6
#10 0x0000000000000000 in ?? ()
This is my piece of code.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void *
GisSnmpThreadProcedure (void *arg)
{
fd_set read_set = { 0 };
int maxfds = 0;
struct timeval agentx_timeout = { 0 };
NETERROR (MGISA, ("thread harendra - running\n"));
/* Initialize the AgentX/SNMP library. */
if (nx_subagent_agentx_init ("GISSubagent", "/var/log/gis_sa.log")
!=
NX_SUBAGENT_SUCCESS)
{
NETERROR (MGISA, ("thread harendra 0- running\n"));
return NULL;
}
init_sipCommonMIB ();
NETERROR (MGISA, ("thread harendra 2- running\n"));
while (1)
{
FD_ZERO (&read_set);
/* Get the AgentX timeout and add the AgentX socket
* descriptor to the read set.
*/
nx_subagent_agentx_select (&read_set, &agentx_timeout, &maxfds);
maxfds += 1;
if (select (maxfds, &read_set, NULL, NULL, &agentx_timeout) < 0)
{
/* Error in select. */
}
/* Process AgentX messages */
nx_subagent_agentx_process (&read_set);
}
return NULL;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++
Thanks,
Harendra
------------------------------------------------------------------------------
_______________________________________________
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