nginx, php-fpm and 502 errors

Jure Pečar pegasus at
Tue Nov 20 21:45:59 MSK 2007

On Tue, 20 Nov 2007 19:16:39 +0300
Igor Sysoev <is at> wrote:

> By the way, it's starnge that Linux returns EAGAIN instead of EINPROGRESS.

I've read somewhere that this is one of those "linux knows better than
posix" things ...

> It's also strange that Linux does not return ENOTCONN error via
> getsockopt(SO_ERROR).

Don't know about this ... This nginx runs inside Virtuozzo VPS, could this
have some effect?

> It's not the middle. It's first FastCGI packet: "\1\1\0\1\0\10\0\0..."
> The scenario is following:
>    connect() returns EAGAIN,
>    nginx adds socket to epoll
>    epoll reports about some condition (may be an error) on the socket
>    nginx writev()s FastCGI request and the writev() returns ENOTCONN.

I see. Is is possible/feasible to check what epoll reports before doing

Our situation is like this:
openads with 500-1000 hits per second
still uses mysql with myisam (table locks!)
every now and then some db operation locks table for more than a few
php-cgi processes get stuck waiting for database
nginx spams error log, because fixed sized pool of php processes wont talk
to it anymore

... is there anything useful to do on the nginx side?
Or should I just set /dev/null for error log? ;)


Jure Pečar

More information about the nginx mailing list