Nginx 的recv() failed 错误解决一例

简介:

本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2012-11/75149.htm


L同学又一次把socket连接往错误的端口上连了。

搬完办公室,D同学说端口有点乱,一台开发机上3个游戏,端口范围不规范,于是就定了下各个游戏的端口区间,负载其中一款游戏的L同学就开始修改端口了。

修改完端口后游戏进不去了。

表现为:

前端一连接就报错

后端接受到了请求并处理了请求

我在输出处打了下log,输出的数据是对的


nginx的error log如下:


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

当时没有去看php-fpm的log,其实应该先去检查下php-fpm的错误log,后来想起后去看了下

Nov 29 12:19:04.040453 [NOTICE] [pool www] child 29815 started

Nov 29 12:20:32.604920 [WARNING] [pool www] child 29785 exited on signal 11 (SIGSEGV) after 246.354264 seconds from start

Nov 29 12:20:32.605383 [NOTICE] [pool www] child 29817 started

Nov 29 12:20:35.668969 [WARNING] [pool www] child 29815 exited on signal 11 (SIGSEGV) after 91.628524 seconds from start

Nov 29 12:20:35.669312 [NOTICE] [pool www] child 29825 started

Nov 29 12:21:45.068408 [WARNING] [pool www] child 29825 exited on signal 11 (SIGSEGV) after 69.399102 seconds from start

Nov 29 12:21:45.068786 [NOTICE] [pool www] child 29836 started

Nov 29 13:00:56.132529 [WARNING] [pool www] child 29817 exited on signal 11 (SIGSEGV) after 2423.527159 seconds from start

Nov 29 13:00:56.132676 [NOTICE] [pool www] child 30046 started

Nov 29 13:01:54.055862 [WARNING] [pool www] child 29836 exited on signal 11 (SIGSEGV) after 2408.987081 seconds from start

Nov 29 13:01:54.056373 [NOTICE] [pool www] child 30060 started

Nov 29 13:02:02.142301 [WARNING] [pool www] child 30046 exited on signal 11 (SIGSEGV) after 66.009642 seconds from start

Nov 29 13:02:02.142795 [NOTICE] [pool www] child 30061 started

Nov 29 13:02:02.925481 [WARNING] [pool www] child 29652 exited on signal 11 (SIGSEGV) after 2750.991891 seconds from start

Nov 29 13:02:02.926067 [NOTICE] [pool www] child 30062 started

Nov 29 13:03:20.960769 [WARNING] [pool www] child 30062 exited on signal 11 (SIGSEGV) after 78.034715 seconds from start

Nov 29 13:03:20.961215 [NOTICE] [pool www] child 30091 started


php worker进程频繁地挂掉和拉起

解决办法:

修改php-fpm配置,只起一个worker进程

kill -USR2 php-fpm_master_pid 重启php-fpm

strace -p only_php_worker_pid

然后发现php worker进程在connect某个端口后就挂掉了

一问L同学这个端口是干嘛的,然后他恍然大悟,哦。。。。。。

原因是没有对redis的pconnect的返回值做判断,然后直接lpush,导致php worker进程直接core掉。


本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2012-11/75149.htm












本文转自ljianbing51CTO博客,原文链接: http://blog.51cto.com/ljianbing/1620190 ,如需转载请自行联系原作者


相关文章
|
应用服务中间件 Linux 开发工具
CentOS7下启动Nginx出现Failed to start nginx.service:unit not found
CentOS7下启动Nginx出现Failed to start nginx.service:unit not found
4231 0
CentOS7下启动Nginx出现Failed to start nginx.service:unit not found
|
应用服务中间件 nginx
Mac Nginx nginx: [emerg] mkdir() “/usr/local/var/run/nginx/client_body_temp“ failed ...
Mac Nginx nginx: [emerg] mkdir() “/usr/local/var/run/nginx/client_body_temp“ failed ...
464 2
|
应用服务中间件 nginx
Nginx nginx: [emerg] bind() to 0.0.0.0:8083 failed (48: Address already in use)
Nginx nginx: [emerg] bind() to 0.0.0.0:8083 failed (48: Address already in use)
755 1
|
Java 应用服务中间件 PHP
Nginx——*5 connect() failed (111: Connection refused) while connecting to upstream
Nginx——*5 connect() failed (111: Connection refused) while connecting to upstream
1364 0
Nginx——*5 connect() failed (111: Connection refused) while connecting to upstream
|
应用服务中间件 nginx Windows
【报错】Windows下启动nginx报:bind() to 0.0.0.0:80 failed...
【报错】Windows下启动nginx报:bind() to 0.0.0.0:80 failed...
964 0
|
存储 应用服务中间件 nginx
【各种问题处理】nginx报错nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
【1月更文挑战第13天】【各种问题处理】nginx报错nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
|
应用服务中间件 nginx
【Nginx异常】[error] 4236#29900: OpenEvent(“Global\ngx_reload_27128“) failed (5: Access is denied)
【Nginx异常】[error] 4236#29900: OpenEvent(“Global\ngx_reload_27128“) failed (5: Access is denied)
1070 0
|
应用服务中间件 nginx
通过nginx访问连接websocket 错误 failed: Error during WebSocket handshake: Unexpected response code: 400
通过nginx访问连接websocket 错误 failed: Error during WebSocket handshake: Unexpected response code: 400
1666 0
|
应用服务中间件 Linux nginx
Linux下启动Nginx时报错:nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Linux下启动Nginx时报错:nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
2181 0
Linux下启动Nginx时报错:nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
|
应用服务中间件 nginx
Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】
Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】
Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】