Linux Netfilter discussions
 help / color / mirror / Atom feed
From: <abirvalg@lavabit.com>
To: netfilter@vger.kernel.org
Subject: nfqueue stuck on queue length >299
Date: Thu, 13 Oct 2011 13:27:06 +0000	[thread overview]
Message-ID: <20111013132706.59fb7006@wwwwww-701SD> (raw)

On 10/13/2011 02:29 PM, abirvalg@lavabit.com wrote:
> In my app one thread sends packets to NFQUEUE and another thread processes that \
> NFQUEUE at the rate of 10 packets per second. I watch the state of NFQUEUEs using \
> watch -n 1 'cat /proc/netnetfilter/nfnetlink_queue' I noticed that if I \
> nfq_set_queue_maxlen to 299, then when the queue fills up to 299 (3rd column), the \
> overflow gets dropped. As soon as new packets cease to arrive, dequeuing begins at \
> the rate of 10 per second until the 3rd columnn reaches 0. All as expected. 
> But as soon as I set NFQUEUE maxlen to 300, the following happens - the overflow \
> gets dropped; but when I stop generating new packets, no dequeuing is taking place, \
> the 3rd column seems to be stuck on 299 and from then on packets for that NFQUEUE \
> don't get queued anymore but are dropped instead. The NFQUEUE still processes \
> packets at the rate of 10 per second, but instead of queuing the overflow, it \
> simply drops it. 
> Is this a bug or a feature? Sure seems like a bug to me.

>Are you using some form of lock (like a mutex) to protect your nfq
>calls? In my experience you need those.

Thank you for you suggestion. It didn't work, alhough I held my breath for a second.
I inserted
pthread_mutex_lock ( &nfqrepeat_mutex ) 
at the start of the queue handler and
pthread_mutex_unlock ( &nfqrepeat_mutex )
right before return 0;
This time around the 3rd column did overcome the vicious 299 figure but stuck on 359 and exhibited the same begaviour as I described above when it would get stuck on 299.

Some kind of voodoo going on?


             reply	other threads:[~2011-10-13 13:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13 13:27 abirvalg [this message]
2011-10-13 10:50 ` nfqueue stuck on queue length >299 Victor Julien
  -- strict thread matches above, loose matches on Subject: below --
2011-10-13 14:05 aletum
2011-10-13 13:37 abirvalg
2011-10-13 12:29 abirvalg
2011-10-13  9:35 ` Victor Julien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111013132706.59fb7006@wwwwww-701SD \
    --to=abirvalg@lavabit.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox