CGI 进程每天崩溃两次,在 apache httpd 进程重启后再次出现。我运行的是 CentOS 6.3 Server、16GB 内存、i5 四核处理器。只有一个 wordpress 博客在运行,网站流量约为 40,000-50,000 次展示。在此期间,我观察到我的 wordpress 网站出现中断。以下是重启前后的 TOP 命令日志,显示 PHP-CGI 进程在 httpd 重启后恢复运行。
top - 08:17:25 up 4 days, 1:15, 1 user, load average: 0.00, 0.09,
0.28 Tasks: 294 total, 1 running, 273 sleeping, 0 stopped, 20 zombie Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi,
0.0%si, 0.0%st Mem: 16260432k total, 11240088k used, 5020344k free, 214684k buffers Swap: 2047992k total, 0k used, 2047992k free,
656664k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2124 drweb 20 0 180m 177m 1712 S 0.0 1.1 18:17.11
drwebd.real 2990 drweb 20 0 180m 175m 336 S 0.0 1.1 0:00.00
drwebd.real 2991 drweb 20 0 180m 175m 336 S 0.0 1.1 0:00.00
drwebd.real 2992 drweb 20 0 180m 175m 336 S 0.0 1.1 0:00.00
drwebd.real 2989 drweb 20 0 180m 175m 332 S 0.0 1.1 0:00.00
drwebd.real 1907
mysql 20 0 2175m 116m 7228 S 0.0 0.7 61:41.00 mysqld
16436 root 30 10 235m 49m 2964 S 0.0 0.3 0:02.83 spamd
16440 popuser 30 10 235m 47m 1028 S 0.0 0.3 0:00.00 spamd
16441 popuser 30 10 235m 47m 1028 S 0.0 0.3 0:00.01 spamd
24175 root 20 0 386m 21m 10m S 0.0 0.1 0:02.59 httpd
1975 named 20 0 379m 21m 2512 S 0.0 0.1 0:00.08 named
9438 apache 20 0 386m 13m 2424 S 0.0 0.1 0:00.07 httpd
9215 apache 20 0 386m 13m 2420 S 0.0 0.1 0:00.08 httpd
11036 apache 20 0 386m 13m 2416 S 0.0 0.1 0:00.03 httpd
10197 apache 20 0 386m 13m 2416 S 0.0 0.1 0:00.06 httpd
[root@ip-173-201-253-36 marketcalls]# service httpd restart
Stopping > httpd: [ OK ]
Starting > httpd: [ OK ]
top - 08:18:05 up 4 days, 1:15, 1 user, load average: 1.38, 0.44,
0.38 Tasks: 318 total, 5 running, 312 sleeping, 0 stopped, 1 zombie Cpu(s): 23.1%us, 7.5%sy, 0.0%ni, 69.2%id, 0.2%wa, 0.0%hi,
0.0%si, 0.0%st Mem: 16260432k total, 12860340k used, 3400092k free, 214688k buffers Swap: 2047992k total, 0k used, 2047992k free,
1181288k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11481 redcry 20 0 321m 115m 42m R 38.1 0.7 0:06.27 php-cgi
11545 redcry 20 0 307m 101m 42m S 36.8 0.6 0:05.78 php-cgi
11482 redcry 20 0 317m 111m 42m S 26.2 0.7 0:05.74 php-cgi
11379 redcry 20 0 310m 104m 42m R 9.6 0.7 0:04.25 php-cgi
11381 redcry 20 0 308m 102m 42m R 7.3 0.6 0:05.64 php-cgi
1907 mysql 20 0 2175m 115m 7228 S 2.0 0.7 61:42.10 mysqld
15 root RT 0 0 0 0 S 0.3 0.0 0:00.32 migration/3
11575 apache 20 0 386m 13m 2388 S 0.3 0.1 0:00.01 httpd
11698 root 20 0 15160 1408 936 R 0.3 0.0 0:00.07 top
1 root 20 0 19356 1552 1244 S 0.0 0.0 0:01.85 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.42 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:05.59 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.19 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.74 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
这些是 PHP-CGI 崩溃时的错误日志:
[Tue Feb 05 08:07:13 2013] [notice] child pid 9468 exit signal Bus error (7)
[Tue Feb 05 08:07:14 2013] [notice] child pid 11009 exit signal Segmentation fault (11)
[Tue Feb 05 08:07:15 2013] [notice] child pid 9819 exit signal Bus error (7)
[Tue Feb 05 08:07:21 2013] [notice] child pid 10276 exit signal Segmentation fault (11)
有人能告诉我如何解决上述错误日志吗?
答案1
呃,通常的方法是让 apache 进行 coredump但这也会带来很多不安全因素,因此永远不应该在生产机器上这样做。你也可以尝试调试。您最近有改变什么吗?