lock up in recvfrom()
"Eugen" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <000601c6395a$02634d60$5f0aa8c0@blueslicemtl> |
Hi,
I'm using net-snmp-5.2.1.2, RH Enterprise Edition.
When sending traps with the configuration:
trapsess -v2c -Ci -cCCCC -r5 -t1 UDP:192.168.xx.yy:162
trap2sink localhost
with snmptrapd running on both machines (local host, and 192.168.xx.yy),
I've encountered the a lock up in recvfrom() function :
#0 0x00fbddae in recvfrom () from /lib/tls/libpthread.so.0
#1 0x0016132e in netsnmp_udp_recv (t=0x85efc00, buf=0xaeea1d88,
size=65536,
#2 0x001436d7 in _sess_read (sessp=0x860e9c0, fdset=0x861e5d0)
#3 0x00144480 in snmp_sess_read (sessp=0x860e9c0, fdset=0xaedfef60)
#4 0x0014349a in snmp_read (fdset=0xaedfef60) at snmp_api.c:5260
#5 0x0011fff0 in snmp_synch_response_cb (ss=0x861e5d0, pdu=0xaedfef60,
#6 0x001200ce in snmp_synch_response (ss=0x861e5d0, pdu=0xaeea0268,
#7 0x002ac438 in send_trap_to_sess (sess=0x861e5d0,
template_pdu=0xaee92118)
#8 0x00b81b8f in send_notifications (major=1, minor=7,
serverarg=0xaee92118,
#9 0x0015c325 in snmp_call_callbacks (major=1, minor=7,
caller_arg=0xaee92118)
#10 0x002ac056 in netsnmp_send_traps (trap=-1, specific=-1,
#11 0x002ac377 in send_enterprise_trap_vars (trap=-1, specific=-1,
#12 0x002ac502 in send_trap_vars (trap=1578772, specific=-1361056608,
I've take a look in snmpUDPDomain.c, netsnmp_udp_recv() and I've made
the following small change:
- rc = recvfrom(t->sock, buf, size, 0, from, &fromlen);
+ rc = recvfrom(t->sock, buf, size, MSG_DONTWAIT, from, &fromlen);
This patch was working well for awhile but after ~5 hours (with ~2-3
traps /sec, with 1 and 11 varbinds) I received a core dump.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Core was generated by `/blue/usr/local/snmp/sbin/snmpd -f -Lf
/blue/var/log/snmpd.log'.
Program terminated with signal 11, Segmentation fault.
#0 0x003b063d in netsnmp_udp_send (t=0x9e321f8, buf=0x1cbd8f39,
size=583, opaque=0x6c, olength=0x6c) at snmpUDPDomain.c:158
158 if (opaque != NULL && *opaque != NULL &&
#1 0x00393d45 in snmp_resend_request (slp=0x6c, rp=0xa6371c10,
incr_retries=1) at snmp_api.c:5949
isp = (struct snmp_internal_session *) 0x1cbd8f39
sp = (netsnmp_session *) 0x9e5f2f0
transport = (netsnmp_transport *) 0x9e321f8
pktbuf = (u_char *) 0x1cbd8980 "224t224t\001"
packet = (u_char *) 0x1cbd8f39
"0\202\002C\002\001\001\004\006public202\0024\002\004!_\002\001"
pktbuf_len = 2048
offset = 583
length = 583
tv = {tv_sec = 0, tv_usec = 482185017}
now = {tv_sec = 3, tv_usec = 165878668}
result = 0
#2 0x003941d4 in snmp_sess_timeout (sessp=0x9e48710) at snmp_api.c:6058
sp = (netsnmp_session *) 0x9e5f2f0
isp = (struct snmp_internal_session *) 0x9e3cb68
rp = (netsnmp_request_list *) 0xa6371c10
orp = (netsnmp_request_list *) 0x0
freeme = (netsnmp_request_list *) 0x0
now = {tv_sec = 1140752367, tv_usec = 376573}
callback = 0x70
magic = (void *) 0x6c
sptr = (struct snmp_secmod_def *) 0x6c
#3 0x00393c05 in snmp_timeout () at snmp_api.c:5851
slp = (struct session_list *) 0x9e48710
#4 0x08050ac5 in receive () at snmpd.c:1185
numfds = 11
readfds = {__fds_bits = {0 <repeats 32 times>}}
writefds = {__fds_bits = {0 <repeats 32 times>}}
exceptfds = {__fds_bits = {0 <repeats 32 times>}}
timeout = {tv_sec = 0, tv_usec = 0}
tvp = (struct timeval *) 0xbfff5ee8
count = 0
block = 0
i = 0
#5 0x08050122 in main (argc=4, argv=0xbfff7204) at snmpd.c:993
c = 0xb7f8a6
"\205211N\213030215\215(213U\b\211\017\211\024$225\034213u213\215\030213
213\225 2111a"
astring = 0x0
options = "aAc:CdD::fhHI:l:L:m:M:p:P:qrsS:UvV-:g:u:x:X", '\0'
<repeats 84 times>
arg = 108
i = 134889333
ret = 64
dont_fork = 1
dont_zero_log = 0
syslog_log = 0
uid = 0
gid = 0
agent_mode = -1
logfile = "/blue/var/log", '\0' <repeats 4083 times>
cptr = 0x0
argvptr = (char **) 0x9dd8d78
pid_file = 0x0
option_compatability = "-Le"
fd = 134889333
PID = (FILE *) 0x0
I guess my patch generated this crash since "opaque" is set in
netsnmp_udp_recv() that I've modified.
At that point I would need some help.
Thanks a lot,
Eugen