502 errors with nginx and php5-fpm

Hi,

I’m getting lots of 502 errors but my nginx logs and php logs don’t give
me
information that can help me identify the problem.

I only have the 502 errors in the access logs. I don’t see any errors in
the
error.log or php logs.

Fist, how can I configure nginx and php so I can get more information
about
the problem?

I already increase fastcgi buffers and php memory limit without success.

Some help would be appreciated.

Thanks

Posted at Nginx Forum:

Hello!

On Sun, Sep 07, 2014 at 07:15:46PM -0400, nfn wrote:

Hi,

I’m getting lots of 502 errors but my nginx logs and php logs don’t give me
information that can help me identify the problem.

I only have the 502 errors in the access logs. I don’t see any errors in the
error.log or php logs.

Fist, how can I configure nginx and php so I can get more information about
the problem?

If the 502 error is returned by nginx, the reason should be logged
to error log, at the “error” level or higher.

If you don’t see anything in your error log, this may mean one of
the following:

  • The error was returned by the backend. (Highly unlikely in case of
    php-fpm, AFAIK.)

  • You are looking into the wrong log, or your error log is configured
    to only log errors with higher levels. See
    Core functionality for details on configuring error
    logging.

It is also possible to configure nginx to write debugging logs,
with all low-level information about request processing, see here:

http://nginx.org/en/docs/debugging_log.html

(This still uses error_log though.)


Maxim D.
http://nginx.org/

Hi,

Here is the debug log: http://pastebin.com/raw.php?i=w8Bwj4pS

Can you help me understand why I have these random 502 error?

Thanks

Posted at Nginx Forum:

What do you see in the php-fpm logs? Maybe the php-fpm processes are not
enough to handle the requests.

On Thursday 11 September 2014 16:42:51 nfn wrote:

Hi,

Here is the debug log: http://pastebin.com/raw.php?i=w8Bwj4pS

Can you help me understand why I have these random 502 error?

Thanks

Have you looked at dmesg? It doesn’t look related to nginx.
That can be caused by segfaults in php-fpm processes, so
you should check what happens with them.

wbr, Valentin V. Bartenev

Hello!

On Thu, Sep 11, 2014 at 04:42:51PM -0400, nfn wrote:

Hi,

Here is the debug log: http://pastebin.com/raw.php?i=w8Bwj4pS

Can you help me understand why I have these random 502 error?

As previously suggested, there is an error logged at “error” level:

2014/09/09 23:55:59 [error] 31744#0: *35461 recv() failed (104:
Connection reset by peer) while reading response header from upstream,
client: 0.0.0.0, server: www.example.com, request: “POST
/index.php?app=members&module=messaging&section=send&do=sendReply&topicID=54192
HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php5-fpm.sock:”, host:
www.example.com”, referrer:
http://www.example.com/index.php?app=members&module=messaging&section=view&do=showConversation&topicID=54192&st=200

As others already explained, the message suggestes there is
something wrong with your backend, most likely it dies for some
reason.


Maxim D.
http://nginx.org/

Hi

Just find out some clues and these are related to segmentation faults.

In php logs ia have: WARNING: [pool www] child 20050 exited on signal 11
(SIGSEGV) after 57.791598 seconds from start
in /var/log/messages I have :php5-fpm[2791]: segfault at fffffffa ip
0832d6d4 sp bf8e51c0 error 5 in php5-fpm[8048000+835000]

I’m running Debian wheezy with dotdeb repo (5.5.16-1~dotdeb.1) and
opcache
with apcu.

This neve happened to me. Should I try to change to xcache with
memcache?
Any suggestions?

Thanks

Posted at Nginx Forum: