# 502 Gateway Timeout with error exited on signal 7 (SIGBUS) after clearing cache (nginx with php5-fpm

**URL:** <https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322>\
**Category:** NGINX\
**Created:** [March 29, 2015, 2:16pm UTC](https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322 "2015-03-29T14:16:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 29, 2015, 2:16pm UTC](https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322/1 "2015-03-29T14:16:37Z")

</div>

Hello,

i’ve got the problem when i load a page multiple times (i.E. 10 Tabs  
with  
autoreload) only some of the pages load others get 502. it doesn’t  
depend on  
the content of the page. when i open the same page in all tabs it’s the  
same  
situation. about 3 out of 10 get 502 errors.  
The 502 Error comes direct when i force the autoload for all pages, so  
there  
is no timeout causing the error because it only takes less that a second  
to  
give the 502. I reconized that this only happens when the cache is  
cleared  
in the cms and needs a rebuild on pageload. if the page is cached i  
don’t  
get any 502 errors anymore. When i disable the caching in modx backend i  
get  
the same errors like manual clearing the cache.

installed on a openVZ VPS with 24GB Ram and 12 Cores also tested on a  
physical machine with 32GB ram and 8 cores. both managed with  
ISPconfig3.

PHP 5.4.39-1~dotdeb.1 (fpm-fcgi) (built: Mar 22 2015 08:08:54)  
nginx/1.6.2  
mysql

The Page is done with Modx CMS Framework 2.3.3

Error Log:  
2015/03/26 00:09:16 [error] 27345#0: \*231 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
178.203.23.132, ser$  
2015/03/26 00:09:16 [error] 27345#0: \*229 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
178.203.23.132, ser$  
2015/03/26 00:09:16 [error] 27345#0: \*234 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
178.203.23.132, ser$

PHP-FPM log  
[25-Mar-2015 23:54:30.875237] DEBUG: pid 28694,  
fpm\_pctl\_perform\_idle\_server\_maintenance(), line 362: [pool web91]  
currently  
0 active children, 6 spare children  
[25-Mar-2015 23:54:30.875247] DEBUG: pid 28694,  
fpm\_pctl\_perform\_idle\_server\_maintenance(), line 379: [pool web32]  
currently  
0 active children, 2 spare children, 2 running children. Spawning rate 1  
[25-Mar-2015 23:54:30.875257] DEBUG: pid 28694,  
fpm\_pctl\_perform\_idle\_server\_maintenance(), line 379: [pool apps]  
currently  
0 active children, 2 spare children,  
2 running children. Spawning rate 1  
[25-Mar-2015 23:54:31.398167] DEBUG: pid 28694, fpm\_event\_loop(), line  
419:  
event module triggered 1 events  
[25-Mar-2015 23:54:31.487717] DEBUG: pid 28694, fpm\_got\_signal(), line  
76:  
received SIGCHLD  
[25-Mar-2015 23:54:31.487757] WARNING: pid 28694, fpm\_children\_bury(),  
line  
252: [pool web91] child 28735 exited on signal 7 (SIGBUS) after  
57.721563  
seconds from start  
[25-Mar-2015 23:54:31.490246] NOTICE: pid 28694, fpm\_children\_make(),  
line  
421: [pool web91] child 28783 started  
[25-Mar-2015 23:54:31.490269] DEBUG: pid 28694, fpm\_event\_loop(), line  
419:  
event module triggered 1 events  
[25-Mar-2015 23:54:31.587862] DEBUG: pid 28694, fpm\_got\_signal(), line  
76:  
received SIGCHLD  
[25-Mar-2015 23:54:31.587906] WARNING: pid 28694, fpm\_children\_bury(),  
line  
252: [pool web91] child 28740 exited on signal 7 (SIGBUS) after  
47.234370  
seconds from start  
[25-Mar-2015 23:54:31.590430] NOTICE: pid 28694, fpm\_children\_make(),  
line  
421: [pool web91] child 28784 started  
[25-Mar-2015 23:54:31.590460] WARNING: pid 28694, fpm\_children\_bury(),  
line  
252: [pool web91] child 28741 exited on signal 7 (SIGBUS) after  
42.284682  
seconds from start

nginx.conf  
tcp\_nopush on;  
tcp\_nodelay on;  
types\_hash\_max\_size 2048;  
server\_name\_in\_redirect off;  
include /etc/nginx/mime.types;  
default\_type application/octet-stream;  
server\_tokens off;  
sendfile on;  
keepalive\_timeout 65;  
charset utf-8;  
client\_max\_body\_size 64m;  
client\_body\_buffer\_size 128k;  
client\_body\_timeout 300s;  
large\_client\_header\_buffers 4 16k;  
server\_names\_hash\_bucket\_size 512;  
server\_names\_hash\_max\_size 2048;  
fastcgi\_buffers 256 16k;  
fastcgi\_buffer\_size 128k;  
fastcgi\_read\_timeout 5m;  
fastcgi\_max\_temp\_file\_size 0;

php-fpm.conf  
emergency\_restart\_threshold = 60  
emergency\_restart\_interval = 1m  
process\_control\_timeout = 60s  
rlimit\_files = 65536  
rlimit\_core = unlimited

anyone got a idea where to look for the source of the problem

Posted at Nginx Forum:

> **[502 Gateway Timeout with error exited on signal 7 (SIGBUS) after clearing...](https://forum.nginx.org/read.php?2,257732,257732#msg-257732)**
>
> Hello, i've got the problem when i load a page multiple times (i.E. 10 Tabs with autoreload) only some of the pages load others get 502. it doesn't depend on the content of the page. when i open the same page in all tabs it's the same situation....

---

<div class="post-metadata">

**Author:** ![degoya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71c47a/32.png) [@degoya](https://www.ruby-forum.com/u/degoya)\
**Post date:** [March 29, 2015, 2:34pm UTC](https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322/2 "2015-03-29T14:34:13Z")

</div>

> installed on a openVZ VPS with 24GB Ram and 12 Cores also tested on a  
> physical machine with 32GB ram and 8 cores. both managed with ISPconfig3.
> 
> PHP 5.4.39-1~dotdeb.1 (fpm-fcgi) (built: Mar 22 2015 08:08:54)  
> nginx/1.6.2  
> mysql

PHP crashes, report the problem to whoever is providing support for this  
dotdeb package or install the proper package from your distribution.

Debian stable ships PHP 5.4.39, it doesn’t make any sense to use dotdeb.

---

<div class="post-metadata">

**Author:** ![degoya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71c47a/32.png) [@degoya](https://www.ruby-forum.com/u/degoya)\
**Post date:** [March 29, 2015, 3:18pm UTC](https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322/3 "2015-03-29T15:18:25Z")

</div>

## Lukas T. Wrote:

> this  
> dotdeb package or install the proper package from your distribution.
> 
> Debian stable ships PHP 5.4.39, it doesn’t make any sense to use  
> dotdeb.

i’ve gemoved the dotdeb php package and installed the php that is  
shipped by  
debian.

PHP 5.4.39-0+deb7u2 (fpm-fcgi) (built: Mar 25 2015 08:35:25)  
Copyright (c) 1997-2014 The PHP Group  
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

still the same result:  
[29-Mar-2015 15:13:55.673640] DEBUG: pid 29675, fpm\_got\_signal(), line  
76:  
received SIGCHLD  
[29-Mar-2015 15:13:55.673690] WARNING: pid 29675, fpm\_children\_bury(),  
line  
252: [pool web92] child 29711 exited on signal 7 (SIGBUS) after  
169.674900  
seconds from start  
[29-Mar-2015 15:13:55.674695] NOTICE: pid 29675, fpm\_children\_make(),  
line  
421: [pool web92] child 29859 started  
[29-Mar-2015 15:13:55.674734] DEBUG: pid 29675, fpm\_event\_loop(), line  
419:  
event module triggered 1 events  
[29-Mar-2015 15:13:55.715464] DEBUG: pid 29675, fpm\_got\_signal(), line  
76:  
received SIGCHLD  
[29-Mar-2015 15:13:55.715498] WARNING: pid 29675, fpm\_children\_bury(),  
line  
252: [pool web92] child 29779 exited on signal 7 (SIGBUS) after  
102.643864  
seconds from start  
[29-Mar-2015 15:13:55.716048] NOTICE: pid 29675, fpm\_children\_make(),  
line  
421: [pool web92] child 29860 started  
[29-Mar-2015 15:13:55.716063] DEBUG: pid 29675, fpm\_event\_loop(), line  
419:  
event module triggered 1 events  
[29-Mar-2015 15:13:56.181544] DEBUG: pid 29675,  
fpm\_pctl\_perform\_idle\_server\_maintenance(), line 379: [pool web92]  
currently  
5 active children, 0 spare children, 5 running children. Spawning rate 1

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,257732,257734#msg-257734](http://forum.nginx.org/read.php?2,257732,257734#msg-257734)

---

<div class="post-metadata">

**Author:** ![degoya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71c47a/32.png) [@degoya](https://www.ruby-forum.com/u/degoya)\
**Post date:** [March 30, 2015, 4:10pm UTC](https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322/4 "2015-03-30T16:10:37Z")

</div>

_As Lukas rightly pointed it out, you are definitely at a wrong location  
to  
seek help for PHP-FPM._

SIGBUS indicates a problem with the way the worker deals with memory. It  
is  
highly likely this is caused by some faulty module.  
[http://serverfault.com/a/474725](http://serverfault.com/a/474725)

One the names which immediately comes to my mind is APC.  
Try to start PHP-FPM by removing as much extensions as possible, and if  
you  
use APC, think about replacing it with APCu (user data cache) and Zend  
OPcache (opcode cache).

## If this does not help, please ask PHP-FPM-related communities.

_B. R._

---

<div class="post-metadata">

**Author:** ![degoya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71c47a/32.png) [@degoya](https://www.ruby-forum.com/u/degoya)\
**Post date:** [March 29, 2015, 3:30pm UTC](https://www.ruby-forum.com/t/502-gateway-timeout-with-error-exited-on-signal-7-sigbus-after-clearing-cache-nginx-with-php5-fpm/241322/5 "2015-03-29T15:30:43Z")

</div>

> > Debian stable ships PHP 5.4.39, it doesn’t make any sense to use  
> > dotdeb.
> 
> i’ve gemoved the dotdeb php package and installed the php that is shipped by  
> debian.

Get a coredump and open a debian bug with the backtrace, here’s how to  
do it:

> **[Generating core-dump for php5-fpm](https://easyengine.io/tutorials/php/core-dump-php5-fpm/)**
>
> Generating core-dump for php5-fpm and viewing backtrace on Ubuntu server

Although I’m not sure if this works in a openvz container …

Anyway, its not an nginx problem, you would be better of talking to  
php people.
