# 104: Connection reset by peer

**URL:** <https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803>\
**Category:** NGINX\
**Created:** [May 8, 2013, 1:30pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803 "2013-05-08T13:30:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 1:30pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/1 "2013-05-08T13:30:08Z")

</div>

Hi All,

I understand that this is a generic error, but it has been frustrating  
trying to solve this issue and i’m not able to find an answer anywhere.  
basically i have an application which is running fine using apache, but  
we  
wanted to try nginx/php5-fpm:

some parts of my application has this connection reset issue, sometimes  
it  
works but inconsistent.  
if it does not work, i restart php5-fpm and it will work again, but  
after  
sometime it will have the same issue.

i’m using:

# nginx -v

nginx version: nginx/1.4.0

# php5-fpm -v

PHP 5.4.14-1~precise+1 (fpm-fcgi) (built: Apr 11 2013 17:18:51)  
Copyright © 1997-2013 The PHP Group  
Zend Engine v2.4.0, Copyright © 1998-2013 Zend Technologies

when i enable debug this is the only thing i can see;

[08-May-2013 18:08:32.545758] DEBUG: pid 358359, fpm\_got\_signal(), line  
72:  
received SIGCHLD  
[08-May-2013 18:08:32.545884] WARNING: pid 358359, fpm\_children\_bury(),  
line 252: [pool legacy] child 358423 exited with code 3 after 342.958315  
seconds from start  
[08-May-2013 18:08:32.548943] NOTICE: pid 358359, fpm\_children\_make(),  
line  
421: [pool legacy] child 359398 started  
[08-May-2013 18:08:32.549023] DEBUG: pid 358359, fpm\_event\_loop(), line  
411: event module triggered 1 events

i have tried different config changes like using static instead of  
dynamic…increase max\_request…increase child …increase server…etc.

one thing i really need is to identify what is causing that connection  
peer  
but logs is not really helping. i tried strace and it still did not show  
me  
anything.

any other way to debug or identify what is causing this issue? totally  
clueless right now.

thank you in advanced.

Regards,  
Ron

---

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 1:54pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/2 "2013-05-08T13:54:07Z")

</div>

After a very long search on Google (almost 15s, including keyboard  
input),  
I found astonishing help, based on the information you provided.

About the FPM children burying, I found a resource on StackOverflow  
linking  
back to the Nginx forum (ML archive):  
[http://stackoverflow.com/questions/2551185/tons-of-fpm-children-bury-in-php-fpm-log-php-5-2-13php-fpm-0-5-13-nginx-0](http://stackoverflow.com/questions/2551185/tons-of-fpm-children-bury-in-php-fpm-log-php-5-2-13php-fpm-0-5-13-nginx-0)

It seems, at first glance, that the children bury and its respawn works  
as  
intended, if you reach the requests limit number. I dunno how to check  
that  
is the case though. Your log entries seem to be silent about that.

## ​M​y 2 cents,

_B. R._

---

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 1:58pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/3 "2013-05-08T13:58:48Z")

</div>

hi,

i’ve seen that info as well ( yes i tried searching for answers as  
mentioned ) and it did not help me unfortunately.  
i’ve increased from 500 to 1000 to 10000. increase children servers etc.

regards,  
ron

---

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 2:12pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/4 "2013-05-08T14:12:50Z")

</div>

Do you have some information on the number of concurrent connections?  
Since you already played with the ‘max\_requests’ parameter too, it seems  
not to be the reason of the trouble. But better be safe than sorry.

## If your actual number of connections/second is greater than what the configuration is expecting then you’ll have your answer. But you don’t provide information allowing to decide on this, and it seems you tried blind changes only. Could you provide your input requests rate?

_B. R._

---

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 2:29pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/5 "2013-05-08T14:29:47Z")

</div>

Hi All,

my apologies, but i think the issue is that php is crashing. was not  
looking at the syslog:

[2617248.127349] php5-fpm[504727] general protection ip:6787a9  
sp:7fff22c5c6f0 error:0 in php5-fpm[400000+700000]

gdb backtrace shows

#0 0x00000000006787a9 in ?? ()  
#1 0x0000000000678940 in ?? ()  
#2 0x00000000006ad82e in zend\_hash\_destroy ()  
#3 0x000000000069e4ab in \_zval\_dtor\_func ()  
#4 0x000000000069031a in \_zval\_ptr\_dtor ()  
#5 0x00000000006ad808 in zend\_hash\_destroy ()  
#6 0x000000000069e4ab in \_zval\_dtor\_func ()  
#7 0x000000000069031a in \_zval\_ptr\_dtor ()  
#8 0x00007fe9a25c056f in apc\_free\_class\_entry\_after\_execution  
(src=0x215e228) at /tmp/pear/temp/APC/apc\_compile.c:1992  
#9 0x00007fe9a25c3ad6 in apc\_deactivate () at  
/tmp/pear/temp/APC/apc\_main.c:948  
#10 apc\_request\_shutdown () at /tmp/pear/temp/APC/apc\_main.c:1042  
#11 0x00007fe9a25b85b5 in zm\_deactivate\_apc (type=,  
module\_number=) at /tmp/pear/temp/APC/php\_apc.c:407  
#12 0x00000000006a6d94 in ?? ()  
#13 0x000000000063efd5 in php\_request\_shutdown ()  
#14 0x000000000042d5b9 in ?? ()  
#15 0x00007fe9a2dbe76d in \_\_libc\_start\_main () from  
/lib/x86\_64-linux-gnu/libc.so.6  
#16 0x000000000042e231 in \_start ()

apc seems to be dying. will try to check what’s wrong. again my  
apologies  
on disturbing the list.

regards,  
Ron

---

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 2:36pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/6 "2013-05-08T14:36:14Z")

</div>

You were right to seek for answers somewhere else than configuration,  
then… ;o)

## Glad you found you answer. I hope you’ll find your way around that crash.

_B. R._

---

<div class="post-metadata">

**Author:** ![ron\_ramos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/dc4da7/32.png) [@ron\_ramos](https://www.ruby-forum.com/u/ron_ramos)\
**Post date:** [May 8, 2013, 2:32pm UTC](https://www.ruby-forum.com/t/104-connection-reset-by-peer/228803/7 "2013-05-08T14:32:08Z")

</div>

Hi B.R.

To answer your question i’m only sending max 10 connection to NGINX on  
my  
load balancer. and even if i took it out of the load balancer  
and there is only me accessing the server, it still happens. thanks!

Regards,  
Ron
