Forum: NGINX fastcgi_keep_conn + PHP-FPM

Posted by Steffen Weber (Guest)
on 2013-02-06 11:01
(Received via mailing list)
The changelog of nginx 1.3.12 mentions a bugfix in the 
"fastcgi_keep_conn"
directive. Therefore I decided to give this feature a try.

Snippet from nginx.conf:

        fastcgi_keep_conn on;

        upstream php {
                server 127.0.0.1:9000;
                keepalive 6;
        }

Snippet from php-fpm.conf:

        listen = 127.0.0.1:9000
        pm = static
        pm.max_children = 4
        pm.max_requests = 5 # very low for demo purpose

Now I run the following command:

while true; do wget http://localhost/test.php -O- > /dev/null; done

After 5 requests (pm.max_requests = 5) wget hangs and nginx logs the
following error:

2013/02/06 10:47:09 [error] 6795#0: *6 readv() failed (104: Connection
reset by peer) while reading upstream, client: ::ffff:127.0.0.1, server:
localhost, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://
127.0.0.1:9000", host: "localhost"

It seems that nginx cannot cope with a restarting php-fpm process. 
Anything
I can do?

Thanks,
Steffen
Posted by Maxim Dounin (Guest)
on 2013-02-06 17:23
(Received via mailing list)
Hello!

On Wed, Feb 06, 2013 at 11:00:42AM +0100, Steffen Weber wrote:

>         }
> while true; do wget http://localhost/test.php -O- > /dev/null; done
> I can do?
From error message it looks like php-fpm closed connection
uncleanly (socket closed with unread data in socket buffer?).

Not idea about details as I can't reproduce it here on FreeBSD
(connection reset on close if there are unread data in socket
buffer is Linux-specific), but I don't think there is a room for
improvement on nginx side.  You may want to ask someone from
php-fpm side to look into this (anight, are you here?).

--
Maxim Dounin
http://nginx.com/support.html
Posted by Steffen Weber (Guest)
on 2013-02-08 17:49
(Received via mailing list)
Yes, might be a problem in PHP (I'm using 5.4.11). Maybe these two PHP
bugs are related:

- https://bugs.php.net/bug.php?id=60961
- https://bugs.php.net/bug.php?id=63395
Posted by Patrick Lists (Guest)
on 2013-02-09 09:54
(Received via mailing list)
On 02/08/2013 05:49 PM, Steffen Weber wrote:
> Yes, might be a problem in PHP (I'm using 5.4.11). Maybe these two PHP
> bugs are related:
>
> - https://bugs.php.net/bug.php?id=60961
> - https://bugs.php.net/bug.php?id=63395

Thanks for that info. Looking at the two bug reports and #60961 in
particular it's unclear in which 5.3 release (if at all) it's been
fixed. Anyone know?

Regards,
Patrick
Posted by Steffen Weber (Guest)
on 2013-02-10 13:30
(Received via mailing list)
On Sat, Feb 9, 2013 at 9:54 AM, Patrick Lists
<nginx-list@puzzled.xs4all.nl> wrote:
> Thanks for that info. Looking at the two bug reports and #60961 in
> particular it's unclear in which 5.3 release (if at all) it's been fixed.
> Anyone know?

Both bugs are still open.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.