Skip to contentSkip to conversation

ENOBUFS in nfq under heavy load

DISCUSSION Stanisław Pitucha 3 participants 6 messages Jul 17, 2007 – Jul 18, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

Hi
After running nf_queue app under heavy load I get ENOBUFS error. Ok - maybe not that heavy - around 100 concurrent voip calls - lots of small udp packets. Nfq socket suddenly hangs. recv() from nfnl_fd() socket returns -1, errno=ENOBUFS and when I try to destroy the queue it stops:
stacktrace with gdb breaking...

#0  0xb7f38410 in __kernel_vsyscall ()
#1  0x4d23d0e1 in recvmsg () from /lib/libc.so.6
#2  0xb7f3185b in nfnl_talk (nfnlh=0x8061080, n=0xbfc9b5ec, peer=0,

groups=0, answer=0x0, junk=0, jarg=0x0)
at ../../libnfnetlink-0.0.25/src/libnfnetlink.c:659
#3 0xb7f35055 in __build_send_cfg_msg (h=0x80611c0, command=<value optimized out>, queuenum=<value optimized out>, pf=0)
at ../../libnetfilter_queue-0.0.13/src/libnetfilter_queue.c:112
#4 0xb7f3511f in nfq_destroy_queue (qh=0x80611f8) at ../../libnetfilter_queue-0.0.13/src/libnetfilter_queue.c:258 #5 0x08049293 in main () at main.cc:287

Any idea how to avoid / fix it? Is the problem on my side? My bufsize is 65535 for reading from nfq socket.

Thanks
Stan

#1 lore raw

Hi,

Quoted 9 lines · Stanisław Pitucha

Hi
After running nf_queue app under heavy load I get ENOBUFS error. Ok - maybe not that heavy - around 100 concurrent voip calls - lots of small udp packets. Nfq socket suddenly hangs. recv() from nfnl_fd() socket returns -1, errno=ENOBUFS and when I try to destroy the queue it stops:
stacktrace with gdb breaking...

Any idea how to avoid / fix it?

You could simply use the limit match to avoid "heavy" load.

Quoted 1 line

Is the problem on my side?

No, it's an implementation problem.

Quoted 4 lines

My bufsize is 65535 for reading from nfq socket.

Thanks
Stan

BR,

Signature · 3 lines
Éric Leblond, [email protected]
Téléphone : 01 44 89 46 39, Fax : 01 44 89 45 01
INL, http://www.inl.fr
#2 lore raw
In reply to Stanisław Pitucha
Quoted 5 lines · Stanis³aw Pitucha

After running nf_queue app under heavy load I get ENOBUFS error. Ok - maybe not that heavy - around 100 concurrent voip calls - lots of small udp packets. Nfq socket suddenly hangs. recv() from nfnl_fd() socket returns -1, errno=ENOBUFS and when I try to destroy the queue it stops:

Which kernel version? What exactly do you mean with "it stops"?

#3 lore raw

Sorry for private mails - my bad.

Quoted 1 line · Eric Leblond

You could simply use the limit match to avoid "heavy" load.

Not an option - I need to balance some traffic - so it will get much more connections than that by default :/

-----

Quoted 1 line · Patrick McHardy

Which kernel version? What exactly do you mean with "it stops"?

2.6.21.5 generic, stock - no patches

By stops I mean that it hangs on nfq_destroy_queue() if there was ENOBUFS before.
When I connected gdb to it I got the stacktrace from the first post. When I break it with ctrl+c, I get:

NFNETLINK answers: No such device

on console and program quits.

#4 lore raw
Quoted 8 lines · Stanis³aw Pitucha
Quoted 1 line · Patrick McHardy

Which kernel version? What exactly do you mean with "it stops"?

2.6.21.5 generic, stock - no patches

By stops I mean that it hangs on nfq_destroy_queue() if there was ENOBUFS before.

Please try to find out what the kernel is doing using sysrq.

Quoted 7 lines

When I connected gdb to it I got the stacktrace from the first post. When I break it with ctrl+c, I get:

NFNETLINK answers: No such device

on console and program quits.

ENODEV can happen when sending a verdict for or unbinding a non-existant queue.

#5 lore raw
Quoted 5 lines · Patrick McHardy
Quoted 2 lines · Stanis³aw Pitucha

By stops I mean that it hangs on nfq_destroy_queue() if there was ENOBUFS before.

Please try to find out what the kernel is doing using sysrq.

Right... not the kernel really :) - libnfnetlink stops at libnfnetlink-0.0.25/src/libnfnetlink.c:659 (in nfnl_talk()). It's just waiting for a datagram from netfilter - recvmsg(nfnlh->fd, &msg, 0). So kernel as far as I can tell... forgot about that socket completely
- so nothing happens. I can't see any calls to NF happening after that. If there's any possibility to get NF in debug mode, I can recompile and post it - is there?
But I don't know if that's recoverable at all - should I be trying to close queue after ENOBUFS? Maybe the socket is closed by design.

Quoted 2 lines

ENODEV can happen when sending a verdict for or unbinding a non-existant queue.

http://pastebin.ca/624472
here I get ENOBUFS on read on line 4, so it breaks out of loop and tries to clean up.

Additionally - I tried to force opening new queue after receiving ENOBUFS. It does one or two successful reads and throws another ENOBUFS.

Anyone knows how to solve this? Or should I just write own module?...