15

I am getting a 502 Bad Gateway from Nginx on a line of PHP code that is working fine in other places of my program ($this->provider = new OAuthProvider();), and that have worked fine before. This is the message I get in the Nginx error log for each 502:

recv() failed (104: Connection reset by peer) while reading response header from upstream

In the PHP-FPM log there is a warning for each 502:

[WARNING] [pool www] child 17427 exited on signal 11 SIGSEGV after 142070.657176 seconds from start

After trying a number of changes to the nginx.conf I am stuck and would very much appreciate any pointers of what to do next.

I'm running Nginx 0.7.67 and PHP 5.3.2 on Ubuntu 10.04.

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
Andreas
  • 638
  • 2
  • 8
  • 14

6 Answers6

4

maybe http://pecl.php.net/bugs/bug.php?id=17689 or bug id #18138

Rob Olmos
  • 2,372
  • 15
  • 24
  • It was bug #17689, which was fixed in revision 301127 of the oauth trunk. Downloaded the trunk and now it works great. Thank you for your help, next time I will search the bug database myself :) – Andreas Sep 01 '10 at 10:22
1

Your PHP process crashed with a segfault ("signal 11 SIGSEGV"), which caused Nginx to see "connection reset by peer" (PHP is the "peer" in this case, and Nginx is telling you "Look, he hung up on me before I could get an answer from him").

Check out the PHP Bug database page on how to report a bug someone will want to fix to find out how to get a backtrace of the segfault so you can report it.

TML
  • 12,813
  • 3
  • 38
  • 45
0

i had the same problem with APC. so i removed it and installed eaccelerator instead. no problem so far.

metthyn
  • 9
  • 1
  • Also had this problem with php-fpm with APC. Not loading the APC extension, problem solved … (or rather, worked around, as I can’t use APC like that …) – Kissaki May 04 '11 at 19:24
  • mh, i need APC, is there a solution for this? – Sebastian May 19 '17 at 15:44
-1

I had similar problems with nginx/lighttpd + php-fcgi(using spawn-fcgi), do you use any opcode cache for php? What i found quite some time ago is that xcache was causing strange behaviour in php-fcgi, some php-fcgi processes randomly died, i was unable to find any pattern. I would recommend to take a look at apc(or other opcode cache) settings, if you are using any. Right now im using nginx + php-fpm on freebsd and have no problems.

nimmen
  • 111
  • 6
  • Nope, I dont use any opcode cache in this case. Including APC is on my todo list though. The problem I had was due to a bug in the oauth implementation and it was already fixed in the trunk. – Andreas Sep 03 '10 at 06:39
-1

ZendOptimizer + APC + php-fpm 5.2.14 gives constantly reproducible SIGSEGV even on phpinfo();.

Mickey Mouse
  • 99
  • 1
  • 3
-3

Try to switch suhosin off. Sometimes it crashes Apache.