nginx, php-fpm and 502 errors

Igor Sysoev is at
Tue Nov 20 22:31:10 MSK 2007

On Tue, Nov 20, 2007 at 07:45:59PM +0100, Jure Pe??ar wrote:

> 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?

I do not know.

> > 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
> writev()?

Unlike kqueue, epoll can not report any errors.
On other side, nginx writes kqueue error reports on the same logging
level as read()/write()'s errors.

> 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
> miliseconds
> 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? ;)

The error_log exists to report errors. Otherwise you will get Windows -
something goes wrong but you do not know why, you may only press
the "OK "button.

You may try to set "alert" level:

       error_log   /path/to/log   alert;

in this location.

Igor Sysoev

More information about the nginx mailing list