Problems with 0.9.1 on not so recent Linux kernels

I’m wondering if I’m the only one having this experience.

I created my own .deb of 0.9.1 and installed on my dev machines and on
Linode. Everything is working perfectly.

In both cases I’m running a fairly recent kernel >= 2.6.32.

Then I tried in machines running a 2.6.26 and there I had problems.
When trying to access a site, one of the worker processes grabs 100%
CPU utilization and the error file gets filed with:

accept() failed (38: Function not implemented)

It grows until exhausting the available disk space.

No pages are served whatsoever. I’m guessing that this is an issue
with a syscall that is missing in those kernel versions, but present
in the newer versions.

I reverted back to 0.8.53 in both machines.

Anyone else experienced this? Igor, Maxim or other nginx
insiders. Does 0.9.1 makes use of a Linux syscall available only in
recent kernels?

Thanks,
— appa

Here’a an ldd of the nginx binary.

    linux-gate.so.1 =>  (0xffffe000)
    libcrypt.so.1 => /lib/libcrypt.so.1 (0x77869000)
    libpcre.so.3 => /lib/libpcre.so.3 (0x77836000)
    libssl.so.0.9.8 => /usr/lib/i686/cmov/libssl.so.0.9.8 

(0x777eb000)
libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8
(0x77693000)
libdl.so.2 => /lib/libdl.so.2 (0x7768f000)
libz.so.1 => /usr/lib/libz.so.1 (0x7767b000)
libGeoIP.so.1 => /usr/lib/libGeoIP.so.1 (0x77643000)
libc.so.6 => /lib/libc.so.6 (0x774fe000)
/lib/ld-linux.so.2 (0x778b4000)

And here’s the dpkg -s:

Package: nginx
Status: install ok installed
Priority: optional
Section: httpd
Installed-Size: 668
Maintainer: António Almeida [email protected]
Architecture: i386
Version: 0.9.1-perusio.1.0
Provides: httpd
Depends: libc6 (>= 2.10), libgeoip1 (>= 1.4.7~beta6+dfsg), libpcre3 (>=
7.7), libssl0.9.8 (>= 0.9.8m-1), zlib1g (>= 1:1.1.4), lsb-base (>=
3.2-14)
Conffiles:
/etc/nginx/sites-available/default 137b379dde77d0ac93cc84c9abf0d5b0
/etc/nginx/fastcgi_params 822165a5f2bed79b8e0fdac84b97066e
/etc/nginx/koi-utf 3e338aca6a53a5420fc791b5ef86f64c
/etc/nginx/koi-win bfa0b80381fed2b1dfcf617b0ba204ec
/etc/nginx/mime.types ab2c1c55348970968afec4b3414add77
/etc/nginx/nginx.conf 7bf139588b5ecd5956f986c9c1442d44
/etc/nginx/win-utf 3749ffe19bedd842eb87e83d544e5ce6
/etc/bash_completion.d/nginx-ensite 5ec3515949ba03272cfc48d46c25f94f
/etc/init.d/nginx 03f3eee584dd80647105e426bf100c5d
/etc/logrotate.d/nginx 607ba9e6ed50716bd899f984eb24c75c
Description: small, but very powerful and efficient web server and mail
proxy
Nginx (engine x) is a web server created by Igor S. and kindly
provided to
the open-source community. This server can be used as standalone HTTP
server
and as a reverse proxy server before some Apache or another big server
to
reduce load to backend servers by many concurrent HTTP-sessions.
.
It can also act as a POP3/IMAP mail proxy with SSL and TLS SNI support.
.
This is a custom version built with upload progress and without WebDAV,
SSI, uwsgi and scgi support.
Homepage: http://nginx.net

On Wed, Dec 01, 2010 at 05:07:51PM +0000, Antnio P. P. Almeida wrote:

accept() failed (38: Function not implemented)

This is wrong message, it should be

  accept4() failed (38: Function not implemented)

It seems that 2.6.26 kernel does not support this syscall.
In next release I will make fallback to standard accept(), if it
accept4() is not implemented in kernel. This will allow to use
on old kernels packages built on modern kernels.

recent kernels?
libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0x77693000)
Priority: optional
/etc/nginx/koi-utf 3e338aca6a53a5420fc791b5ef86f64c
and as a reverse proxy server before some Apache or another big server to
nginx Info Page

Igor S.
Igor Sysoev

Hello!

On Wed, Dec 01, 2010 at 05:07:51PM +0000, António P. P. Almeida wrote:

Anyone else experienced this? Igor, Maxim or other nginx
insiders. Does 0.9.1 makes use of a Linux syscall available only in
recent kernels?

0.9.1 tries to use accept4() on Linux if it’s available. If you
compiled nginx on host with accept4() but run resulting binary on
an older kernel - it won’t work.

To Igor:

As I already said in patch review[1], it’s probably good idea to
provide runtime fallback to accept() in such situation.

[1] accept4 should be used in nginx( linux platform)

Maxim D.

On 1 Dez 2010 17h36 WET, [email protected] wrote:

Hello Maxim,

In both cases I’m running a fairly recent kernel >= 2.6.32.
with a syscall that is missing in those kernel versions, but
an older kernel - it won’t work.
I compiled in both machines running a 2.6.24. One is an amd64
architecture, so I have to recompile there, since my dev machines are
i386.

The other I compiled also. I rebuilt the package in each machine.

Only on Linode I installed the binary package without rebuilding.

Thanks,
— appa

Hello!

On Wed, Dec 01, 2010 at 05:41:41PM +0000, António P. P. Almeida wrote:

recent kernels?

Only on Linode I installed the binary package without rebuilding.

Ah, it looks like Igor committed Simon’s patch even without fixing
availability test, and it basically checks only if one have recent
enough glibc. So if you have recent glibc but an old kernel - it
won’t work at all.

Just in case: workaround to recompile with explicitly disabled
accept4() support, e.g. with something like:

./configure --with-cc-opt="-DNGX_HAVE_ACCEPT4=0"

Maxim D.

On 1 Dez 2010 17h36 WET, [email protected] wrote:

Hello Igor,

accept() failed (38: Function not implemented)

This is wrong message, it should be

accept4() failed (38: Function not implemented)

No it’s:

2010/12/01 18:13:17 [alert] 25796#0: accept() failed (38: Function not
implemented)

This is on the amd64 machine:

It seems that 2.6.26 kernel does not support this syscall.
In next release I will make fallback to standard accept(), if it
accept4() is not implemented in kernel. This will allow to use
on old kernels packages built on modern kernels.

Ok.

Thanks,
— appa

On 1 Dez 2010 17h58 WET, [email protected] wrote:

Hello Maxim,

Ah, it looks like Igor committed Simon’s patch even without fixing
availability test, and it basically checks only if one have recent
enough glibc. So if you have recent glibc but an old kernel - it
won’t work at all.

Just in case: workaround to recompile with explicitly disabled
accept4() support, e.g. with something like:

./configure --with-cc-opt="-DNGX_HAVE_ACCEPT4=0"

Yes I just rebuilt the package with:

export CONFIGURE_OPTS=’–with-cc-opt="-DNGX_HAVE_ACCEPT4=0"’

and the customary:

dpkg-buildpackage -r -T build

and

dpkg-buildpackage -r -T binary

It works perfectly now.

Thanks,
— appa

On 1 Dez 2010 19h38 WET, [email protected] wrote:

Could you try the attched patch ? It should report once
accept4() failed (38: Function not implemented)
on old kernel and fallback to usual accept().

I did. It works.

2010/12/01 20:38:24 [alert] 1080#0: accept4() failed (38: Function not
implemented)

Just once and everything is back to normal.

Great work Igor.

Thanks,
— appa

Hello!

On Wed, Dec 01, 2010 at 10:38:58PM +0300, Igor S. wrote:

accept4() failed (38: Function not implemented)
on old kernel and fallback to usual accept().

[…]

#endif

  •        if (use_accept4 && err == NGX_ENOSYS) {
    
  •            use_accept4 = 0;
    
  •            continue;
    

You have to reset ngx_inherited_nonblocking here as well.

Maxim D.

On Wed, Dec 01, 2010 at 06:01:22PM +0000, Antnio P. P. Almeida wrote:

No it’s:

2010/12/01 18:13:17 [alert] 25796#0: accept() failed (38: Function not
implemented)

This is on the amd64 machine:

I meant that nginx issues the wrong message and it should be fixed.


Igor S.
http://sysoev.ru/en/