Nginx 1.0 + IPv6 kills server when accessed over IPv6

I just upgraded from 0.8.54 to 1.0 (I’ve also tried various versions of
0.9.x experiencing the same issue).

Running 2.6.35-28-generic #50-Ubuntu SMP on a 64bit Ubuntu 10.10

As soon as I try to open a connection to an ipv6 enabled site via ipv6 -
the
server just hangs instantly, requiring a hard reboot (nothing is dumped
to
any logs).

Since the server is located in another country I’ve only managed to grab
a
screenshot of the KVM:

This does not happen when using 0.8.54 (or any other 0.8.x version I’ve
used
before).

Not sure if this is an Nginx issue, kernel issue, hardware issue, but I
thought this would be the best place to start.
Has anyone else experienced something similar?

Kind regards,
Egill R.

On Mon, Apr 18, 2011 at 05:26:25PM +0000, Egill R. Erlendsson |
Grapewire wrote:

screenshot of the KVM:
http://i55.tinypic.com/dfkuc2.png

This does not happen when using 0.8.54 (or any other 0.8.x version I’ve used
before).

Not sure if this is an Nginx issue, kernel issue, hardware issue, but I
thought this would be the best place to start.
Has anyone else experienced something similar?

This is certainly a kernel issue, because userland application
should not be able to kill the kernel. It’s strange that panic occurs in
ipv6 connect() becuase nginx can do only ipv4 connect().


Igor S.

Hello!

On Mon, Apr 18, 2011 at 05:26:25PM +0000, Egill R. Erlendsson |
Grapewire wrote:

screenshot of the KVM:
http://i55.tinypic.com/dfkuc2.png

This does not happen when using 0.8.54 (or any other 0.8.x version I’ve used
before).

Not sure if this is an Nginx issue, kernel issue, hardware issue, but I
thought this would be the best place to start.
Has anyone else experienced something similar?

Obviously “server just hangs” means this isn’t nginx issue. Most
likely it’s kernel problem, though it may be triggered by
something nginx does (in recent versions).

I suspect the following changes in nginx may be problematic:

  1. Use of accept4() syscall, as of 0.9.0+.

  2. Listen backlog -1 on Linux, as of 0.9.5+.

Could you please test which exactly version causes problems (and
which one is last working)?

Maxim D.

Ill be testing a 1.0.0 build on a centos kernel (with openvz) as soon as
the
Datacenter gets the IPv6 config right for me. Ill let you all know if
that
crashes.

On Mon, Apr 18, 2011 at 06:25:52PM -0400, egill wrote:

Thanks for your time!

Try to set the backlog option for listening socket:

   listen  80  backlog=1024;

or
listen [::]:80 backlog=1024;


Igor S.

Igor S. Wrote:

On Mon, Apr 18, 2011 at 06:25:52PM -0400, egill
wrote:

Igor S.

I set the backlog for the IPv6 listen entry to 1024 and it works like a
charm.

Excellent, thanks for your help!

Kind regards,
Egill R.

Posted at Nginx Forum:

what does the function “backlog=1024” exactly do?

Hi again.

Thanks for the replies. I tested 0.9.4 and it works - 0.9.5 and newer
all reproduce the same problem.

Maxim, it would be interesting to know if you have any further thoughts
on that.

At least now I know what to look for and I guess I’ll be careful with
0.9.5+ in the near future! :slight_smile:

Thanks for your time!

Kind regards,
Egill R.

Posted at Nginx Forum:

On Wed, Apr 20, 2011 at 12:30:36AM +1200, Ryan B wrote:

what does the function “backlog=1024” exactly do?

man listen:

The backlog argument defines the maximum length to which the queue of
pending
connections for sockfd may grow. If a connection request arrives when
the
queue is full, the client may receive an error with an indication of
ECONNREFUSED or, if the underlying protocol supports retransmission, the
request may be ignored so that a later reattempt at connection succeeds.

Changes with nginx 0.9.5 21 Feb
2011

*) Change: now nginx uses a default listen backlog value -1 on 

Linux.


Igor S.