nginx – 池www退出信号15(SIGTERM):执行超时

前端之家收集整理的这篇文章主要介绍了nginx – 池www退出信号15(SIGTERM):执行超时前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在1GB单核VPS上使用Nginx 1.5.1和PHP-FPM(PHP 5.3.26)运行Drupal 6,在SSD存储上有3GB的交换空间.我刚刚从共享主机切换到这个非托管VPS,因为我的网站太重了,所以我还在学习绳索.我的流量中等,我并没有真正监控它,但谷歌Adsense通常每天记录接近30K的页面浏览量.我通常有50到80个经过身份验证的用户登录,还有几百个匿名用户在任何给定时刻点击Boost静态HTML缓存.我配置了最多10个PHP-FPM子进程.我正在使用“ondemand”PHP-FPM流程管理器.

我遇到了一个很难调试的偶然错误,因为它似乎是随机的.在用户的30个故意帖子中,有1个是重复的.我配置它,以便在第一次单击后禁用发布按钮,因此它不是双击的结果.事实上,当我发帖时,它甚至发生在我身上.双柱发生在彼此的几秒钟内.我检查了日志文件,并且重复的帖子似乎总是对应于Nginx POST错误:recv()失败(104:由对等方重置连接),同时从上游读取响应头.此事件似乎与index.PHP的执行超时错误PHP-FPM工作进程的后续SIGTERM的PHP-FPM错误有关.

以下是Nginx访问和错误日​​志以及PHP-FPM错误日志:

Nginx_acess.log文件

1.2.3.4 - - [02/Jul/2013:12:34:34 -0500] "POST /comment/reply/22802/420734?quote=1 HTTP/1.1" 302 5 "http://example.com/comment/reply/22802/420734?quote=1" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:34 -0500] "GET /node/22802 HTTP/1.1" 200 18775 "http://example.com/comment/reply/22802/420734?quote=1" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:35 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21333 HTTP/1.1" 200 707 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:35 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21121 HTTP/1.1" 200 707 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:35 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21122 HTTP/1.1" 200 707 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:43 -0500] "GET /comment/delete/420748 HTTP/1.1" 200 5262 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:44 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=20342 HTTP/1.1" 200 707 "http://example.com/comment/delete/420748" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:44 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21333 HTTP/1.1" 200 707 "http://example.com/comment/delete/420748" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:44 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21121 HTTP/1.1" 200 707 "http://example.com/comment/delete/420748" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:45 -0500] "POST /comment/delete/420748 HTTP/1.1" 302 5 "http://example.com/comment/delete/420748" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:46 -0500] "GET /node/22802 HTTP/1.1" 200 18533 "http://example.com/comment/delete/420748" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:47 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21406 HTTP/1.1" 200 707 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:47 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=21121 HTTP/1.1" 200 707 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"
1.2.3.4 - - [02/Jul/2013:12:34:47 -0500] "GET /sites/all/modules/ad/serve.PHP?o=image&a=20343 HTTP/1.1" 200 707 "http://example.com/node/22802" "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0"

Nginx_error.log文件

2013/07/02 11:12:52 [error] 1821#0: *2140 recv() Failed (104: Connection reset by peer) while reading response header from upstream,client: 1.2.3.4,server: example.com,request: "GET / HTTP/1.1",upstream: "fastcgi://127.0.0.1:9532",host: "example.com",referrer: "http://example.com/node/22802"
2013/07/02 11:16:23 [error] 1821#0: *3020 recv() Failed (104: Connection reset by peer) while reading response header from upstream,referrer: "http://example.com/node/22802"
2013/07/02 11:18:13 [error] 1821#0: *3375 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /node/22763 HTTP/1.1",referrer: "http://example.com/node/22763"
2013/07/02 11:18:43 [error] 1821#0: *3576 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /comment/edit/420694 HTTP/1.1",referrer: "http://example.com/node/22763"
2013/07/02 11:19:33 [error] 1821#0: *3576 recv() Failed (104: Connection reset by peer) while reading response header from upstream,referrer: "http://example.com/node/22763/edit"
2013/07/02 11:22:33 [error] 1821#0: *4397 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /forum HTTP/1.1",referrer: "http://example.com/"
2013/07/02 11:29:23 [error] 1821#0: *5811 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /node/22470 HTTP/1.1",referrer: "http://example.com/"
2013/07/02 11:34:43 [error] 1821#0: *6794 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /recent-posts HTTP/1.1",referrer: "http://example.com/forum"
2013/07/02 11:41:33 [error] 1821#0: *8082 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /sites/all/modules/ad/serve.PHP?o=image&a=20343 HTTP/1.1",referrer: "http://example.com/node/22802"
2013/07/02 11:50:03 [error] 1821#0: *9435 recv() Failed (104: Connection reset by peer) while reading response header from upstream,referrer: "http://example.com/"
2013/07/02 11:55:21 [error] 1821#0: *10378 open() "/var/www/drupal6/sites/all/modules/smileys/packs/Roving/no-swear.png" Failed (2: No such file or directory),request: "GET /sites/all/modules/smileys/packs/Roving/no-swear.png HTTP/1.1",referrer: "http://example.com/node/22802/edit"
2013/07/02 12:02:33 [error] 1821#0: *11677 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /user/5170/track/navigation HTTP/1.1",referrer: "http://example.com/user/5170"
2013/07/02 12:03:03 [error] 1821#0: *11736 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "GET /node/15888 HTTP/1.1",referrer: "http://example.com/user/5170/track/navigation"
2013/07/02 12:15:23 [error] 1821#0: *13882 recv() Failed (104: Connection reset by peer) while reading response header from upstream,referrer: "http://example.com/admin/reports/access/44258972"
2013/07/02 12:34:33 [error] 1821#0: *17088 recv() Failed (104: Connection reset by peer) while reading response header from upstream,request: "POST /comment/reply/22802/420734?quote=1 HTTP/1.1",referrer: "http://example.com/comment/reply/22802/420734?quote=1"

PHP-fpm_error.log文件

[02-Jul-2013 12:34:13] WARNING: [pool www] child 5768,script '/var/www/drupal6/index.PHP' (request: "GET /index.PHP") execution timed out (39.990074 sec),terminating
[02-Jul-2013 12:34:13] WARNING: [pool www] child 5767,script '/var/www/drupal6/index.PHP' (request: "GET /index.PHP") execution timed out (40.002037 sec),terminating
[02-Jul-2013 12:34:13] WARNING: [pool www] child 5767 exited on signal 15 (SIGTERM) after 50.005181 seconds from start
[02-Jul-2013 12:34:13] NOTICE: [pool www] child 5796 started
[02-Jul-2013 12:34:13] WARNING: [pool www] child 5768 exited on signal 15 (SIGTERM) after 40.019244 seconds from start
[02-Jul-2013 12:34:13] NOTICE: [pool www] child 5797 started
[02-Jul-2013 12:34:33] WARNING: [pool www] child 5769,script '/var/www/drupal6/index.PHP' (request: "POST /index.PHP") execution timed out (59.990557 sec),terminating
[02-Jul-2013 12:34:33] WARNING: [pool www] child 5769 exited on signal 15 (SIGTERM) after 60.014359 seconds from start
[02-Jul-2013 12:34:33] NOTICE: [pool www] child 5801 started

它们被修剪并稍微混淆,以显示我今天12:34发生的重复发布错误,IP地址为“1.2.3.4”.发生欺诈的节点是22802.

当我在以前的共享webhost上运行Apache / FastCGI时,没有发生此问题.我还应该提到我使用Redis进行缓存和Zend Optimizer opcache.但是我尝试禁用这两种机制以避免欺骗错误,并且没有任何区别.

感谢您的任何帮助,您可以提供!

最佳答案
好吧,我要回答我自己的问题.问题显然与我正在使用的request_terminate_timeout = 30s值有关,可能与ondemand FPM进程管理器结合使用.双帖总是与PHP-FPM超时错误相结合,并且紧跟在之后立即杀死子进程.所以我禁用了request_terminate_timeout,它似乎是多余的,因为PHP.ini文件已经指定了30秒的超时.我也意识到我并不真正需要ondemand进程管理器,因为我是这个盒子上唯一一个负载相当稳定的用户,所以我切换到静态并将pm.max_requests设置得相当低到100.这可以防止内存泄漏.

这些变化中的一个或两个有效地消除了重复的帖子.

猜你在找的Nginx相关文章