nginx errors “recv() failed (104: Connection reset by peer) while reading response header from upstream” The 2019 Stack Overflow Developer Survey Results Are In502 Error When Trying to Post/Update in Wordpress After HHVM InstallationMysterious Upstream Client ::ffff:81.70.140.65…changes on each errorHelp needed setting up nginx to serve static filesBlank Page: wordpress on nginx+php-fpmConfigure php5-fpm for many concurrent usersNGINX + PHP FPM connect() failed (110: Connection timed out) while connecting to upstreamNginx gives 504 Gateway Time-out once moved to livephpmyadmin having problems on nginx and php-fpm on RHEL 6NGINX don't parse .php5 as .phpNginX + WordPress + SSL + non-www + W3TC vhost config file questionsnginx recv() failed (104: Connection reset by peer) while reading response header from upstream403 Forbidden nginx (nginx/1.8.0)
How much of the clove should I use when using big garlic heads?
The difference between dialogue marks
Can we generate random numbers using irrational numbers like π and e?
What information about me do stores get via my credit card?
What is this sharp, curved notch on my knife for?
Is it okay to consider publishing in my first year of PhD?
A word that means fill it to the required quantity
Is it safe to harvest rainwater that fell on solar panels?
Kerning for subscripts of sigma?
What is the meaning of Triage in Cybersec world?
Is bread bad for ducks?
Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?
A female thief is not sold to make restitution -- so what happens instead?
What is this business jet?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
The phrase "to the numbers born"?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
How to quickly solve partial fractions equation?
Button changing its text & action. Good or terrible?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Keeping a retro style to sci-fi spaceships?
Getting crown tickets for Statue of Liberty
How to translate "being like"?
"as much details as you can remember"
nginx errors “recv() failed (104: Connection reset by peer) while reading response header from upstream”
The 2019 Stack Overflow Developer Survey Results Are In502 Error When Trying to Post/Update in Wordpress After HHVM InstallationMysterious Upstream Client ::ffff:81.70.140.65…changes on each errorHelp needed setting up nginx to serve static filesBlank Page: wordpress on nginx+php-fpmConfigure php5-fpm for many concurrent usersNGINX + PHP FPM connect() failed (110: Connection timed out) while connecting to upstreamNginx gives 504 Gateway Time-out once moved to livephpmyadmin having problems on nginx and php-fpm on RHEL 6NGINX don't parse .php5 as .phpNginX + WordPress + SSL + non-www + W3TC vhost config file questionsnginx recv() failed (104: Connection reset by peer) while reading response header from upstream403 Forbidden nginx (nginx/1.8.0)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a server which was working ok until 3rd Oct 2013 at 10:50am when it began to intermittently return "502 Bad Gateway" errors to the client.
Approximately 4 out of 5 browser requests succeed but about 1 in 5 fail with a 502.
The nginx error log contains many hundreds of these errors;
2013/10/05 06:28:17 [error] 3111#0: *54528 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 66.249.66.75, server: www.bec-components.co.uk request: ""GET /?_n=Fridgefreezer/Hotpoint/8591P;_i=x8078 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.bec-components.co.uk"
However the PHP error log does not contain any matching errors.
Is there a way to get PHP to give me more info about why it is resetting the connection?
This is nginx.conf
;
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events
worker_connections 1024;
http
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 30;
tcp_nodelay on;
client_max_body_size 100m;
gzip on;
gzip_types text/plain application/xml text/javascript application/x-javascript text/css;
gzip_disable "MSIE [1-6].(?!.*SV1)";
include /gvol/sites/*/nginx.conf;
And this is the .conf
for this site;
server jpg
## bec-components.co.uk ##
server
server_name bec-components.co.uk;
rewrite ^/(.*) http://www.bec-components.co.uk$1 permanent;
php nginx
add a comment |
I have a server which was working ok until 3rd Oct 2013 at 10:50am when it began to intermittently return "502 Bad Gateway" errors to the client.
Approximately 4 out of 5 browser requests succeed but about 1 in 5 fail with a 502.
The nginx error log contains many hundreds of these errors;
2013/10/05 06:28:17 [error] 3111#0: *54528 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 66.249.66.75, server: www.bec-components.co.uk request: ""GET /?_n=Fridgefreezer/Hotpoint/8591P;_i=x8078 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.bec-components.co.uk"
However the PHP error log does not contain any matching errors.
Is there a way to get PHP to give me more info about why it is resetting the connection?
This is nginx.conf
;
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events
worker_connections 1024;
http
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 30;
tcp_nodelay on;
client_max_body_size 100m;
gzip on;
gzip_types text/plain application/xml text/javascript application/x-javascript text/css;
gzip_disable "MSIE [1-6].(?!.*SV1)";
include /gvol/sites/*/nginx.conf;
And this is the .conf
for this site;
server jpg
## bec-components.co.uk ##
server
server_name bec-components.co.uk;
rewrite ^/(.*) http://www.bec-components.co.uk$1 permanent;
php nginx
What was changed on that day? Updated your application or PHP? What's your application? Did you enable debugging in php-fpm?
– Pothi Kalimuthu
Oct 5 '13 at 15:34
Nothing was changed on that day. Server config was not changed, nor were any PHP scripts. It's not out of disk space. My application is just a set ofPHP
scripts. I'm not usingphp-fpm
, I'm just runningphp-fastcgi
by doingphp-cgi -b 127.0.0.1:9000
. It's been working without fault for 3 years. I can't work out why it has developed this issue.
– Nigel Alderton
Oct 5 '13 at 16:20
I had similar issue recently where nginx was complaining about Connection reset by peer while reading response header from upstream, in my case it was uWSGI which was the real problem, restarting uWSGI fixed the issue for me, as to why it was happening is a separate issue.
– APZ
Jan 26 '14 at 10:46
Your upstream service (php-cgi -b 127.0.0.1:9000
) is failing intermittently, perhaps due to increased traffic and lack of resources.
– LinuxDevOps
Mar 29 '14 at 14:53
add a comment |
I have a server which was working ok until 3rd Oct 2013 at 10:50am when it began to intermittently return "502 Bad Gateway" errors to the client.
Approximately 4 out of 5 browser requests succeed but about 1 in 5 fail with a 502.
The nginx error log contains many hundreds of these errors;
2013/10/05 06:28:17 [error] 3111#0: *54528 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 66.249.66.75, server: www.bec-components.co.uk request: ""GET /?_n=Fridgefreezer/Hotpoint/8591P;_i=x8078 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.bec-components.co.uk"
However the PHP error log does not contain any matching errors.
Is there a way to get PHP to give me more info about why it is resetting the connection?
This is nginx.conf
;
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events
worker_connections 1024;
http
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 30;
tcp_nodelay on;
client_max_body_size 100m;
gzip on;
gzip_types text/plain application/xml text/javascript application/x-javascript text/css;
gzip_disable "MSIE [1-6].(?!.*SV1)";
include /gvol/sites/*/nginx.conf;
And this is the .conf
for this site;
server jpg
## bec-components.co.uk ##
server
server_name bec-components.co.uk;
rewrite ^/(.*) http://www.bec-components.co.uk$1 permanent;
php nginx
I have a server which was working ok until 3rd Oct 2013 at 10:50am when it began to intermittently return "502 Bad Gateway" errors to the client.
Approximately 4 out of 5 browser requests succeed but about 1 in 5 fail with a 502.
The nginx error log contains many hundreds of these errors;
2013/10/05 06:28:17 [error] 3111#0: *54528 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 66.249.66.75, server: www.bec-components.co.uk request: ""GET /?_n=Fridgefreezer/Hotpoint/8591P;_i=x8078 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.bec-components.co.uk"
However the PHP error log does not contain any matching errors.
Is there a way to get PHP to give me more info about why it is resetting the connection?
This is nginx.conf
;
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events
worker_connections 1024;
http
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 30;
tcp_nodelay on;
client_max_body_size 100m;
gzip on;
gzip_types text/plain application/xml text/javascript application/x-javascript text/css;
gzip_disable "MSIE [1-6].(?!.*SV1)";
include /gvol/sites/*/nginx.conf;
And this is the .conf
for this site;
server jpg
## bec-components.co.uk ##
server
server_name bec-components.co.uk;
rewrite ^/(.*) http://www.bec-components.co.uk$1 permanent;
php nginx
php nginx
asked Oct 5 '13 at 11:28
Nigel AldertonNigel Alderton
3762615
3762615
What was changed on that day? Updated your application or PHP? What's your application? Did you enable debugging in php-fpm?
– Pothi Kalimuthu
Oct 5 '13 at 15:34
Nothing was changed on that day. Server config was not changed, nor were any PHP scripts. It's not out of disk space. My application is just a set ofPHP
scripts. I'm not usingphp-fpm
, I'm just runningphp-fastcgi
by doingphp-cgi -b 127.0.0.1:9000
. It's been working without fault for 3 years. I can't work out why it has developed this issue.
– Nigel Alderton
Oct 5 '13 at 16:20
I had similar issue recently where nginx was complaining about Connection reset by peer while reading response header from upstream, in my case it was uWSGI which was the real problem, restarting uWSGI fixed the issue for me, as to why it was happening is a separate issue.
– APZ
Jan 26 '14 at 10:46
Your upstream service (php-cgi -b 127.0.0.1:9000
) is failing intermittently, perhaps due to increased traffic and lack of resources.
– LinuxDevOps
Mar 29 '14 at 14:53
add a comment |
What was changed on that day? Updated your application or PHP? What's your application? Did you enable debugging in php-fpm?
– Pothi Kalimuthu
Oct 5 '13 at 15:34
Nothing was changed on that day. Server config was not changed, nor were any PHP scripts. It's not out of disk space. My application is just a set ofPHP
scripts. I'm not usingphp-fpm
, I'm just runningphp-fastcgi
by doingphp-cgi -b 127.0.0.1:9000
. It's been working without fault for 3 years. I can't work out why it has developed this issue.
– Nigel Alderton
Oct 5 '13 at 16:20
I had similar issue recently where nginx was complaining about Connection reset by peer while reading response header from upstream, in my case it was uWSGI which was the real problem, restarting uWSGI fixed the issue for me, as to why it was happening is a separate issue.
– APZ
Jan 26 '14 at 10:46
Your upstream service (php-cgi -b 127.0.0.1:9000
) is failing intermittently, perhaps due to increased traffic and lack of resources.
– LinuxDevOps
Mar 29 '14 at 14:53
What was changed on that day? Updated your application or PHP? What's your application? Did you enable debugging in php-fpm?
– Pothi Kalimuthu
Oct 5 '13 at 15:34
What was changed on that day? Updated your application or PHP? What's your application? Did you enable debugging in php-fpm?
– Pothi Kalimuthu
Oct 5 '13 at 15:34
Nothing was changed on that day. Server config was not changed, nor were any PHP scripts. It's not out of disk space. My application is just a set of
PHP
scripts. I'm not using php-fpm
, I'm just running php-fastcgi
by doing php-cgi -b 127.0.0.1:9000
. It's been working without fault for 3 years. I can't work out why it has developed this issue.– Nigel Alderton
Oct 5 '13 at 16:20
Nothing was changed on that day. Server config was not changed, nor were any PHP scripts. It's not out of disk space. My application is just a set of
PHP
scripts. I'm not using php-fpm
, I'm just running php-fastcgi
by doing php-cgi -b 127.0.0.1:9000
. It's been working without fault for 3 years. I can't work out why it has developed this issue.– Nigel Alderton
Oct 5 '13 at 16:20
I had similar issue recently where nginx was complaining about Connection reset by peer while reading response header from upstream, in my case it was uWSGI which was the real problem, restarting uWSGI fixed the issue for me, as to why it was happening is a separate issue.
– APZ
Jan 26 '14 at 10:46
I had similar issue recently where nginx was complaining about Connection reset by peer while reading response header from upstream, in my case it was uWSGI which was the real problem, restarting uWSGI fixed the issue for me, as to why it was happening is a separate issue.
– APZ
Jan 26 '14 at 10:46
Your upstream service (
php-cgi -b 127.0.0.1:9000
) is failing intermittently, perhaps due to increased traffic and lack of resources.– LinuxDevOps
Mar 29 '14 at 14:53
Your upstream service (
php-cgi -b 127.0.0.1:9000
) is failing intermittently, perhaps due to increased traffic and lack of resources.– LinuxDevOps
Mar 29 '14 at 14:53
add a comment |
10 Answers
10
active
oldest
votes
i'd always trust if my webservers are telling me: 502 Bad Gateway
- what is the uptime of your fastcgi/nginx - process?
- do you monitor network-connections?
- can you confirm/deny a change of visitors-count around that day?
what does it mean:
you fastcgi-process is not accessible by nginx; either to slow or not corresponding at all. bad gateway means: nginx cannot fastcgi_pass to that defined ressource 127.0.0.1:9000; at that very specific moment.
your inital error-logs tells it all:
.
recv() failed
-> nginx failed
(104: Connection reset by peer) while reading response header from upstream,
-> no complete answer, or no answer at all
upstream: "fastcgi://127.0.0.1:9000",
-> who is he, who failed???
from my limited pov i'd suggest:
- restart your fastcgi_process / server
- check your access-log
- enable debug-log
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
2
I see, so theGateway
in this case is the PHP server. Thank you.
– Nigel Alderton
Mar 31 '14 at 16:44
restart your fastcgi_process / server
is what helped me, thans
– realtebo
Apr 8 at 10:08
add a comment |
I know this topic is old, but it still continues to pop up occasionally, so, looking for answers on the web, I came up with the following three possibilities:
- A programming error is sometimes segfaulting php-fpm, which in turn means that the connection with nginx will be severed. This will usually leave at least some logs around and/or core dumps, which can be analysed further.
- For some reason, PHP is not being able to write a session file (usually:
session.save_path = "/var/lib/php/sessions"
). This can be bad permissions, bad ownership, bad user/group, or more esoteric/obscure issues like running out of inodes on that directory (or even a full disk!). This will usually not leave many core dumps around and possibly not even anything on the PHP error logs. - Even more tricky to debug: an extension is misbehaving (occasionally hitting some kind of inner limit, or a bug which is not triggered all the time), segfaulting, and bringing the php-fpm process down with it — thus closing the connection with nginx. The usual culprits are APC, memcache/d, etc. (in my case it was the New Relic extension), so the idea here is to turn each extension off until the error disappears.
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
add a comment |
Kept getting this as well. Solved it by increasing the opcache
memory limit, if you use it (replacement for APC). Seems PHP-FPM dropped connections whenever the cache got too full. This is also the reason why shgnInc's answer fixes it for a short time.
So find the file /etc/php5/fpm/php.ini
(or equivalent in your distribution) and increase memory_consumption
to whatever level your site needs. Disabling opcache
may also work.
[opcache]
opcache.memory_consumption = 196
add a comment |
You may want to consider this git on github:
https://gist.github.com/amichaelgrant/90d99d7d5d48bf8fd209
I encountered a similar situation, when I checked error logs for my upstream servers they were reporting some ulimit error so I increased that to 1000000(on both the upstream and nginx boxes) and everything worked fine
add a comment |
In my case of same problem, I just restart the php-fpm
service so it solved.
sudo service php5-fpm restart
Or some times this problem happen because of huge of requests. By default the pm.max_requests
in php5-fpm maybe is 100 or below.
To solve it increase its value depend on the your site's requests, For example 500.
And after the you have to restart the service
add a comment |
In my case, disabling xdebug extension did help.
add a comment |
I just had a similar problem:
You connect to php-fpm on Port 9000. (fastcgi://127.0.0.1:9000)
Standard configuration on Ubuntu on my server is:
/etc/php/7.0/fpm/pool.d/www.conf:
listen = /run/php/php7.0-fpm.sock
you have to change this to:
listen = 0.0.0.0:9000
In my case, I did update my server 1 1/2 Month ago, overwriting my costom configuration with the default. Now having restarted php-fpm this error came to effect with delay.
add a comment |
This issue may also arise if a PHP-FPM process exceeds its allocated memory limit. When this happens, the connection between NGINX and PHP-FPM is severed and NGINX returns a 502 Bad Gateway
. The PHP-FPM process memory limit is controlled by the memory_limit
variable. This can be set with php_admin_value[memory_limit]
in the PHP-FPM configuration file.
It is important to note that the memory limit applies on a per-script basis. With n
PHP-FPM processes, the total memory usage can be up to memory_limit * n
. Be sure to check that your machine has sufficient memory headroom!
add a comment |
For me it was the server running out of memory and php-fpm getting killed by OOM killer. The solution was to increase amount of server memory.
add a comment |
For me it was because php-fpm was hitting the max_children
limit. The php-fpm log for the pool in question pointed me in the right direction
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f543999%2fnginx-errors-recv-failed-104-connection-reset-by-peer-while-reading-respon%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
i'd always trust if my webservers are telling me: 502 Bad Gateway
- what is the uptime of your fastcgi/nginx - process?
- do you monitor network-connections?
- can you confirm/deny a change of visitors-count around that day?
what does it mean:
you fastcgi-process is not accessible by nginx; either to slow or not corresponding at all. bad gateway means: nginx cannot fastcgi_pass to that defined ressource 127.0.0.1:9000; at that very specific moment.
your inital error-logs tells it all:
.
recv() failed
-> nginx failed
(104: Connection reset by peer) while reading response header from upstream,
-> no complete answer, or no answer at all
upstream: "fastcgi://127.0.0.1:9000",
-> who is he, who failed???
from my limited pov i'd suggest:
- restart your fastcgi_process / server
- check your access-log
- enable debug-log
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
2
I see, so theGateway
in this case is the PHP server. Thank you.
– Nigel Alderton
Mar 31 '14 at 16:44
restart your fastcgi_process / server
is what helped me, thans
– realtebo
Apr 8 at 10:08
add a comment |
i'd always trust if my webservers are telling me: 502 Bad Gateway
- what is the uptime of your fastcgi/nginx - process?
- do you monitor network-connections?
- can you confirm/deny a change of visitors-count around that day?
what does it mean:
you fastcgi-process is not accessible by nginx; either to slow or not corresponding at all. bad gateway means: nginx cannot fastcgi_pass to that defined ressource 127.0.0.1:9000; at that very specific moment.
your inital error-logs tells it all:
.
recv() failed
-> nginx failed
(104: Connection reset by peer) while reading response header from upstream,
-> no complete answer, or no answer at all
upstream: "fastcgi://127.0.0.1:9000",
-> who is he, who failed???
from my limited pov i'd suggest:
- restart your fastcgi_process / server
- check your access-log
- enable debug-log
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
2
I see, so theGateway
in this case is the PHP server. Thank you.
– Nigel Alderton
Mar 31 '14 at 16:44
restart your fastcgi_process / server
is what helped me, thans
– realtebo
Apr 8 at 10:08
add a comment |
i'd always trust if my webservers are telling me: 502 Bad Gateway
- what is the uptime of your fastcgi/nginx - process?
- do you monitor network-connections?
- can you confirm/deny a change of visitors-count around that day?
what does it mean:
you fastcgi-process is not accessible by nginx; either to slow or not corresponding at all. bad gateway means: nginx cannot fastcgi_pass to that defined ressource 127.0.0.1:9000; at that very specific moment.
your inital error-logs tells it all:
.
recv() failed
-> nginx failed
(104: Connection reset by peer) while reading response header from upstream,
-> no complete answer, or no answer at all
upstream: "fastcgi://127.0.0.1:9000",
-> who is he, who failed???
from my limited pov i'd suggest:
- restart your fastcgi_process / server
- check your access-log
- enable debug-log
i'd always trust if my webservers are telling me: 502 Bad Gateway
- what is the uptime of your fastcgi/nginx - process?
- do you monitor network-connections?
- can you confirm/deny a change of visitors-count around that day?
what does it mean:
you fastcgi-process is not accessible by nginx; either to slow or not corresponding at all. bad gateway means: nginx cannot fastcgi_pass to that defined ressource 127.0.0.1:9000; at that very specific moment.
your inital error-logs tells it all:
.
recv() failed
-> nginx failed
(104: Connection reset by peer) while reading response header from upstream,
-> no complete answer, or no answer at all
upstream: "fastcgi://127.0.0.1:9000",
-> who is he, who failed???
from my limited pov i'd suggest:
- restart your fastcgi_process / server
- check your access-log
- enable debug-log
edited Mar 31 '14 at 15:51
answered Oct 6 '13 at 7:26
that guy from over therethat guy from over there
1,191811
1,191811
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
2
I see, so theGateway
in this case is the PHP server. Thank you.
– Nigel Alderton
Mar 31 '14 at 16:44
restart your fastcgi_process / server
is what helped me, thans
– realtebo
Apr 8 at 10:08
add a comment |
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
2
I see, so theGateway
in this case is the PHP server. Thank you.
– Nigel Alderton
Mar 31 '14 at 16:44
restart your fastcgi_process / server
is what helped me, thans
– realtebo
Apr 8 at 10:08
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
Ok. What are my webservers telling me?
– Nigel Alderton
Mar 31 '14 at 14:49
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
see my edit (what does it mean)
– that guy from over there
Mar 31 '14 at 15:51
2
2
I see, so the
Gateway
in this case is the PHP server. Thank you.– Nigel Alderton
Mar 31 '14 at 16:44
I see, so the
Gateway
in this case is the PHP server. Thank you.– Nigel Alderton
Mar 31 '14 at 16:44
restart your fastcgi_process / server
is what helped me, thans– realtebo
Apr 8 at 10:08
restart your fastcgi_process / server
is what helped me, thans– realtebo
Apr 8 at 10:08
add a comment |
I know this topic is old, but it still continues to pop up occasionally, so, looking for answers on the web, I came up with the following three possibilities:
- A programming error is sometimes segfaulting php-fpm, which in turn means that the connection with nginx will be severed. This will usually leave at least some logs around and/or core dumps, which can be analysed further.
- For some reason, PHP is not being able to write a session file (usually:
session.save_path = "/var/lib/php/sessions"
). This can be bad permissions, bad ownership, bad user/group, or more esoteric/obscure issues like running out of inodes on that directory (or even a full disk!). This will usually not leave many core dumps around and possibly not even anything on the PHP error logs. - Even more tricky to debug: an extension is misbehaving (occasionally hitting some kind of inner limit, or a bug which is not triggered all the time), segfaulting, and bringing the php-fpm process down with it — thus closing the connection with nginx. The usual culprits are APC, memcache/d, etc. (in my case it was the New Relic extension), so the idea here is to turn each extension off until the error disappears.
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
add a comment |
I know this topic is old, but it still continues to pop up occasionally, so, looking for answers on the web, I came up with the following three possibilities:
- A programming error is sometimes segfaulting php-fpm, which in turn means that the connection with nginx will be severed. This will usually leave at least some logs around and/or core dumps, which can be analysed further.
- For some reason, PHP is not being able to write a session file (usually:
session.save_path = "/var/lib/php/sessions"
). This can be bad permissions, bad ownership, bad user/group, or more esoteric/obscure issues like running out of inodes on that directory (or even a full disk!). This will usually not leave many core dumps around and possibly not even anything on the PHP error logs. - Even more tricky to debug: an extension is misbehaving (occasionally hitting some kind of inner limit, or a bug which is not triggered all the time), segfaulting, and bringing the php-fpm process down with it — thus closing the connection with nginx. The usual culprits are APC, memcache/d, etc. (in my case it was the New Relic extension), so the idea here is to turn each extension off until the error disappears.
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
add a comment |
I know this topic is old, but it still continues to pop up occasionally, so, looking for answers on the web, I came up with the following three possibilities:
- A programming error is sometimes segfaulting php-fpm, which in turn means that the connection with nginx will be severed. This will usually leave at least some logs around and/or core dumps, which can be analysed further.
- For some reason, PHP is not being able to write a session file (usually:
session.save_path = "/var/lib/php/sessions"
). This can be bad permissions, bad ownership, bad user/group, or more esoteric/obscure issues like running out of inodes on that directory (or even a full disk!). This will usually not leave many core dumps around and possibly not even anything on the PHP error logs. - Even more tricky to debug: an extension is misbehaving (occasionally hitting some kind of inner limit, or a bug which is not triggered all the time), segfaulting, and bringing the php-fpm process down with it — thus closing the connection with nginx. The usual culprits are APC, memcache/d, etc. (in my case it was the New Relic extension), so the idea here is to turn each extension off until the error disappears.
I know this topic is old, but it still continues to pop up occasionally, so, looking for answers on the web, I came up with the following three possibilities:
- A programming error is sometimes segfaulting php-fpm, which in turn means that the connection with nginx will be severed. This will usually leave at least some logs around and/or core dumps, which can be analysed further.
- For some reason, PHP is not being able to write a session file (usually:
session.save_path = "/var/lib/php/sessions"
). This can be bad permissions, bad ownership, bad user/group, or more esoteric/obscure issues like running out of inodes on that directory (or even a full disk!). This will usually not leave many core dumps around and possibly not even anything on the PHP error logs. - Even more tricky to debug: an extension is misbehaving (occasionally hitting some kind of inner limit, or a bug which is not triggered all the time), segfaulting, and bringing the php-fpm process down with it — thus closing the connection with nginx. The usual culprits are APC, memcache/d, etc. (in my case it was the New Relic extension), so the idea here is to turn each extension off until the error disappears.
answered Jun 5 '16 at 23:24
Gwyneth LlewelynGwyneth Llewelyn
19114
19114
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
add a comment |
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
+1 In my case it was #1 - programming error.
– Nimbuz
Sep 6 '16 at 1:49
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
We ran into this error and disabling the New Relic APM PHP extension revealed a more specific error that allowed us to track down the problem: [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 262144 bytes) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableRegularPrice.php on line 142 [29-Jan-2018 16:47:48 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 323584 bytes) in Unknown on line 0 My guess is that New Relic choked on the "Unknown" path.
– Erik Hansen
Jan 29 '18 at 17:43
add a comment |
Kept getting this as well. Solved it by increasing the opcache
memory limit, if you use it (replacement for APC). Seems PHP-FPM dropped connections whenever the cache got too full. This is also the reason why shgnInc's answer fixes it for a short time.
So find the file /etc/php5/fpm/php.ini
(or equivalent in your distribution) and increase memory_consumption
to whatever level your site needs. Disabling opcache
may also work.
[opcache]
opcache.memory_consumption = 196
add a comment |
Kept getting this as well. Solved it by increasing the opcache
memory limit, if you use it (replacement for APC). Seems PHP-FPM dropped connections whenever the cache got too full. This is also the reason why shgnInc's answer fixes it for a short time.
So find the file /etc/php5/fpm/php.ini
(or equivalent in your distribution) and increase memory_consumption
to whatever level your site needs. Disabling opcache
may also work.
[opcache]
opcache.memory_consumption = 196
add a comment |
Kept getting this as well. Solved it by increasing the opcache
memory limit, if you use it (replacement for APC). Seems PHP-FPM dropped connections whenever the cache got too full. This is also the reason why shgnInc's answer fixes it for a short time.
So find the file /etc/php5/fpm/php.ini
(or equivalent in your distribution) and increase memory_consumption
to whatever level your site needs. Disabling opcache
may also work.
[opcache]
opcache.memory_consumption = 196
Kept getting this as well. Solved it by increasing the opcache
memory limit, if you use it (replacement for APC). Seems PHP-FPM dropped connections whenever the cache got too full. This is also the reason why shgnInc's answer fixes it for a short time.
So find the file /etc/php5/fpm/php.ini
(or equivalent in your distribution) and increase memory_consumption
to whatever level your site needs. Disabling opcache
may also work.
[opcache]
opcache.memory_consumption = 196
answered Feb 2 '17 at 2:34
Manuel RielManuel Riel
16113
16113
add a comment |
add a comment |
You may want to consider this git on github:
https://gist.github.com/amichaelgrant/90d99d7d5d48bf8fd209
I encountered a similar situation, when I checked error logs for my upstream servers they were reporting some ulimit error so I increased that to 1000000(on both the upstream and nginx boxes) and everything worked fine
add a comment |
You may want to consider this git on github:
https://gist.github.com/amichaelgrant/90d99d7d5d48bf8fd209
I encountered a similar situation, when I checked error logs for my upstream servers they were reporting some ulimit error so I increased that to 1000000(on both the upstream and nginx boxes) and everything worked fine
add a comment |
You may want to consider this git on github:
https://gist.github.com/amichaelgrant/90d99d7d5d48bf8fd209
I encountered a similar situation, when I checked error logs for my upstream servers they were reporting some ulimit error so I increased that to 1000000(on both the upstream and nginx boxes) and everything worked fine
You may want to consider this git on github:
https://gist.github.com/amichaelgrant/90d99d7d5d48bf8fd209
I encountered a similar situation, when I checked error logs for my upstream servers they were reporting some ulimit error so I increased that to 1000000(on both the upstream and nginx boxes) and everything worked fine
edited Nov 11 '14 at 17:51
Michael Hampton♦
174k27320647
174k27320647
answered Nov 11 '14 at 17:48
AMG AnonymousAMG Anonymous
211
211
add a comment |
add a comment |
In my case of same problem, I just restart the php-fpm
service so it solved.
sudo service php5-fpm restart
Or some times this problem happen because of huge of requests. By default the pm.max_requests
in php5-fpm maybe is 100 or below.
To solve it increase its value depend on the your site's requests, For example 500.
And after the you have to restart the service
add a comment |
In my case of same problem, I just restart the php-fpm
service so it solved.
sudo service php5-fpm restart
Or some times this problem happen because of huge of requests. By default the pm.max_requests
in php5-fpm maybe is 100 or below.
To solve it increase its value depend on the your site's requests, For example 500.
And after the you have to restart the service
add a comment |
In my case of same problem, I just restart the php-fpm
service so it solved.
sudo service php5-fpm restart
Or some times this problem happen because of huge of requests. By default the pm.max_requests
in php5-fpm maybe is 100 or below.
To solve it increase its value depend on the your site's requests, For example 500.
And after the you have to restart the service
In my case of same problem, I just restart the php-fpm
service so it solved.
sudo service php5-fpm restart
Or some times this problem happen because of huge of requests. By default the pm.max_requests
in php5-fpm maybe is 100 or below.
To solve it increase its value depend on the your site's requests, For example 500.
And after the you have to restart the service
edited Nov 10 '15 at 6:09
answered Oct 26 '15 at 8:19
shgnIncshgnInc
79111226
79111226
add a comment |
add a comment |
In my case, disabling xdebug extension did help.
add a comment |
In my case, disabling xdebug extension did help.
add a comment |
In my case, disabling xdebug extension did help.
In my case, disabling xdebug extension did help.
answered Oct 2 '17 at 22:24
VasiliyVasiliy
111
111
add a comment |
add a comment |
I just had a similar problem:
You connect to php-fpm on Port 9000. (fastcgi://127.0.0.1:9000)
Standard configuration on Ubuntu on my server is:
/etc/php/7.0/fpm/pool.d/www.conf:
listen = /run/php/php7.0-fpm.sock
you have to change this to:
listen = 0.0.0.0:9000
In my case, I did update my server 1 1/2 Month ago, overwriting my costom configuration with the default. Now having restarted php-fpm this error came to effect with delay.
add a comment |
I just had a similar problem:
You connect to php-fpm on Port 9000. (fastcgi://127.0.0.1:9000)
Standard configuration on Ubuntu on my server is:
/etc/php/7.0/fpm/pool.d/www.conf:
listen = /run/php/php7.0-fpm.sock
you have to change this to:
listen = 0.0.0.0:9000
In my case, I did update my server 1 1/2 Month ago, overwriting my costom configuration with the default. Now having restarted php-fpm this error came to effect with delay.
add a comment |
I just had a similar problem:
You connect to php-fpm on Port 9000. (fastcgi://127.0.0.1:9000)
Standard configuration on Ubuntu on my server is:
/etc/php/7.0/fpm/pool.d/www.conf:
listen = /run/php/php7.0-fpm.sock
you have to change this to:
listen = 0.0.0.0:9000
In my case, I did update my server 1 1/2 Month ago, overwriting my costom configuration with the default. Now having restarted php-fpm this error came to effect with delay.
I just had a similar problem:
You connect to php-fpm on Port 9000. (fastcgi://127.0.0.1:9000)
Standard configuration on Ubuntu on my server is:
/etc/php/7.0/fpm/pool.d/www.conf:
listen = /run/php/php7.0-fpm.sock
you have to change this to:
listen = 0.0.0.0:9000
In my case, I did update my server 1 1/2 Month ago, overwriting my costom configuration with the default. Now having restarted php-fpm this error came to effect with delay.
answered Jul 24 '18 at 15:49
Fabian ThommenFabian Thommen
1115
1115
add a comment |
add a comment |
This issue may also arise if a PHP-FPM process exceeds its allocated memory limit. When this happens, the connection between NGINX and PHP-FPM is severed and NGINX returns a 502 Bad Gateway
. The PHP-FPM process memory limit is controlled by the memory_limit
variable. This can be set with php_admin_value[memory_limit]
in the PHP-FPM configuration file.
It is important to note that the memory limit applies on a per-script basis. With n
PHP-FPM processes, the total memory usage can be up to memory_limit * n
. Be sure to check that your machine has sufficient memory headroom!
add a comment |
This issue may also arise if a PHP-FPM process exceeds its allocated memory limit. When this happens, the connection between NGINX and PHP-FPM is severed and NGINX returns a 502 Bad Gateway
. The PHP-FPM process memory limit is controlled by the memory_limit
variable. This can be set with php_admin_value[memory_limit]
in the PHP-FPM configuration file.
It is important to note that the memory limit applies on a per-script basis. With n
PHP-FPM processes, the total memory usage can be up to memory_limit * n
. Be sure to check that your machine has sufficient memory headroom!
add a comment |
This issue may also arise if a PHP-FPM process exceeds its allocated memory limit. When this happens, the connection between NGINX and PHP-FPM is severed and NGINX returns a 502 Bad Gateway
. The PHP-FPM process memory limit is controlled by the memory_limit
variable. This can be set with php_admin_value[memory_limit]
in the PHP-FPM configuration file.
It is important to note that the memory limit applies on a per-script basis. With n
PHP-FPM processes, the total memory usage can be up to memory_limit * n
. Be sure to check that your machine has sufficient memory headroom!
This issue may also arise if a PHP-FPM process exceeds its allocated memory limit. When this happens, the connection between NGINX and PHP-FPM is severed and NGINX returns a 502 Bad Gateway
. The PHP-FPM process memory limit is controlled by the memory_limit
variable. This can be set with php_admin_value[memory_limit]
in the PHP-FPM configuration file.
It is important to note that the memory limit applies on a per-script basis. With n
PHP-FPM processes, the total memory usage can be up to memory_limit * n
. Be sure to check that your machine has sufficient memory headroom!
answered Mar 21 at 22:17
FrancisFrancis
1
1
add a comment |
add a comment |
For me it was the server running out of memory and php-fpm getting killed by OOM killer. The solution was to increase amount of server memory.
add a comment |
For me it was the server running out of memory and php-fpm getting killed by OOM killer. The solution was to increase amount of server memory.
add a comment |
For me it was the server running out of memory and php-fpm getting killed by OOM killer. The solution was to increase amount of server memory.
For me it was the server running out of memory and php-fpm getting killed by OOM killer. The solution was to increase amount of server memory.
answered Mar 31 at 17:58
Konstantin PereiaslovKonstantin Pereiaslov
1011
1011
add a comment |
add a comment |
For me it was because php-fpm was hitting the max_children
limit. The php-fpm log for the pool in question pointed me in the right direction
add a comment |
For me it was because php-fpm was hitting the max_children
limit. The php-fpm log for the pool in question pointed me in the right direction
add a comment |
For me it was because php-fpm was hitting the max_children
limit. The php-fpm log for the pool in question pointed me in the right direction
For me it was because php-fpm was hitting the max_children
limit. The php-fpm log for the pool in question pointed me in the right direction
answered 1 hour ago
bruchowskibruchowski
13116
13116
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f543999%2fnginx-errors-recv-failed-104-connection-reset-by-peer-while-reading-respon%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What was changed on that day? Updated your application or PHP? What's your application? Did you enable debugging in php-fpm?
– Pothi Kalimuthu
Oct 5 '13 at 15:34
Nothing was changed on that day. Server config was not changed, nor were any PHP scripts. It's not out of disk space. My application is just a set of
PHP
scripts. I'm not usingphp-fpm
, I'm just runningphp-fastcgi
by doingphp-cgi -b 127.0.0.1:9000
. It's been working without fault for 3 years. I can't work out why it has developed this issue.– Nigel Alderton
Oct 5 '13 at 16:20
I had similar issue recently where nginx was complaining about Connection reset by peer while reading response header from upstream, in my case it was uWSGI which was the real problem, restarting uWSGI fixed the issue for me, as to why it was happening is a separate issue.
– APZ
Jan 26 '14 at 10:46
Your upstream service (
php-cgi -b 127.0.0.1:9000
) is failing intermittently, perhaps due to increased traffic and lack of resources.– LinuxDevOps
Mar 29 '14 at 14:53