# Problems with 0.9.1 on not so recent Linux kernels

**URL:** <https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935>\
**Category:** NGINX\
**Created:** [December 1, 2010, 6:13pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935 "2010-12-01T18:13:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 1, 2010, 6:13pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/1 "2010-12-01T18:13:02Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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](http://nginx.net)

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 6:37pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/2 "2010-12-01T18:37:29Z")

</div>

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  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)  
> –  
> Igor S.  
> [Igor Sysoev](http://sysoev.ru/en/)

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 6:37pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/3 "2010-12-01T18:37:29Z")

</div>

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)](http://nginx.org/pipermail/nginx/2010-November/023524.html)

Maxim D.

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 6:46pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/4 "2010-12-01T18:46:54Z")

</div>

On 1 Dez 2010 17h36 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 7:00pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/5 "2010-12-01T19:00:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 7:06pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/6 "2010-12-01T19:06:24Z")

</div>

On 1 Dez 2010 17h36 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/7 "2010-12-01T19:44:04Z")

</div>

On 1 Dez 2010 17h58 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 2, 2010, 2:33pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/8 "2010-12-02T14:33:58Z")

</div>

On 1 Dez 2010 19h38 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 2, 2010, 5:56pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/9 "2010-12-02T17:56:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [December 1, 2010, 7:11pm UTC](https://www.ruby-forum.com/t/problems-with-0-9-1-on-not-so-recent-linux-kernels/199935/10 "2010-12-01T19:11:26Z")

</div>

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.

> **[Igor Sysoev](http://sysoev.ru/en/)**
