我尝试了各种方法,但每隔几天(几乎每天)FPM 就会停止提供页面,并且我会收到 502(来自 Cherokee 网络服务器)
日志中充满了以下内容:
[15-Sep-2014 10:17:46] WARNING: [pool www] child 10135 exited on signal 11 (SIGSEGV - core dumped) after 15.512406 seconds from start
[15-Sep-2014 10:17:46] NOTICE: [pool www] child 10138 started
[15-Sep-2014 10:18:02] WARNING: [pool www] child 10138 exited on signal 11 (SIGSEGV - core dumped) after 15.657950 seconds from start
[15-Sep-2014 10:18:02] NOTICE: [pool www] child 10166 started
[15-Sep-2014 10:18:20] WARNING: [pool www] child 10212 exited on signal 11 (SIGSEGV - core dumped) after 10.192596 seconds from start
[15-Sep-2014 10:18:20] NOTICE: [pool www] child 10214 started
[15-Sep-2014 10:19:08] WARNING: [pool www] child 10216 exited on signal 11 (SIGSEGV - core dumped) after 42.754452 seconds from start
[15-Sep-2014 10:19:08] NOTICE: [pool www] child 10242 started
[15-Sep-2014 10:20:22] WARNING: [pool www] child 10332 exited on signal 11 (SIGSEGV - core dumped) after 14.862183 seconds from start
[15-Sep-2014 10:20:22] NOTICE: [pool www] child 10494 started
[15-Sep-2014 10:20:48] WARNING: [pool www] child 10494 exited on signal 11 (SIGSEGV - core dumped) after 26.415409 seconds from start
[15-Sep-2014 10:20:48] NOTICE: [pool www] child 10498 started
[15-Sep-2014 10:32:48] WARNING: [pool www] child 11718 exited on signal 11 (SIGSEGV - core dumped) after 21.319360 seconds from start
[15-Sep-2014 10:32:48] NOTICE: [pool www] child 11720 started
每次发生这种情况时,最后的日志都类似于
[15-Sep-2014 11:01:34] WARNING: [pool www] server reached max_children setting (50), consider raising it
这是根据切诺基同时建立的连接,它甚至不是一个尖峰......
我已经尝试过动态、固定按需,但没有任何变化。无论我将 max_children 设置成什么,它最终都会消失。
我不知道为什么它不能恢复,但现在要么切换到其他东西,要么制定一个每 30 分钟重新启动 FPM 的 crontab
服务器
- rackspace 第一代 1024 MB RAM,40 GB 磁盘
- Ubuntu 12.04 LTS
- 切诺基 1.2.103
PHP 5.3.10-1ubuntu3.11 带有 Suhosin-Patch (cli)(构建于:2014 年 4 月 4 日 01:30:04)版权所有 (c) 1997-2012 The PHP Group Zend Engine v2.3.0,版权所有 (c) 1998-2012 Zend Technologies
网站每月的页面浏览量约为 2k,因此负载并不算大。
内存使用率徘徊在 300 -> 400mb 左右,交换为空,平均负载小于 ~1.5
fpm 配置
[global]
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
emergency_restart_threshold = 5
emergency_restart_interval = 1s
process.max = 75
include=/etc/php5/fpm/pool.d/*.conf
池配置
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
pm = ondemand
pm.max_children = 50
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.process_idle_timeout = 10s
pm.max_requests = 100
pm.status_path = /status
ping.path = /fpm/ping
chdir = /
答案1
增加服务器数量、更改配置或代码都无法解决分段错误。即使在 2014 年,5.3.10 也已经过时了,需要升级。您可以使用 gdb 分析核心转储,但没有人会对修复旧版本 php 中的错误感兴趣:升级。