ulogd hang at fclose sometimes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ulogd2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
ulgod2.
on production system, ulogd keep write traffic into pcap file through pcap plugin.
and log rotate will transfer the pcap file to other place.
but it will hang after several days.
when the problem happened, the bt trace is following:
(gdb) bt
#0 0x00007fb0875055bb in ?? () from /lib/x86_
#1 0x00007fb087480558 in ?? () from /lib/x86_
#2 0x00007fb08747e95c in _IO_un_link () from /lib/x86_
#3 0x00007fb087471ad5 in fclose () from /lib/x86_
#4 0x00007fb0867eada8 in signal_pcap (upi=0x7fb08995
#5 signal_pcap (upi=0x7fb08995
#6 0x00007fb087e0c138 in deliver_
#7 <signal handler called>
#8 0x00007fb087472f91 in fwrite () from /lib/x86_
#9 0x00007fb0867eac8f in interp_pcap (upi=0x7fb08995
#10 0x00007fb087e0df0b in ulogd_propagate
#11 0x00007fb087201066 in interp_packet (ldata=
#12 msg_cb (data=0x7fb0899
#13 msg_cb (gh=<optimized out>, nfmsg=0x7fb087c
#14 0x00007fb086ffc145 in ?? () from /usr/lib/
#15 0x00007fb086df6036 in ?? () from /usr/lib/
#16 0x00007fb086df60ba in nfnl_handle_packet () from /usr/lib/
#17 0x00007fb087200978 in nful_read_cb (param=
#18 nful_read_cb (fd=<optimized out>, what=<optimized out>, param=0x7fb0899
#19 0x00007fb087e0e486 in ulogd_select_main (tv=<optimized out>) at select.c:105
#20 0x00007fb087e0bdc8 in ulogd_main_loop () at ulogd.c:934
#21 main (argc=<optimized out>, argv=<optimized out>) at ulogd.c:1477
Root cause is calling fclose() in signal handler context.
Functions like fopen(), fclose(), malloc(), free(), etc are not allowed to call in signal handler context.
I believe following upstream commit will solve your issue.
http:// git.netfilter. org/ulogd2/ commit/ ?id=1f70d2ba45e 2b067777d5386b8 d3f2e09be9118b
In my environment, I applied this patch to ulogd-2.0.4 and it works well.
I cloud applied upstream patch cleanly to ulogd-2.0.4.