Linux

php5-fpm 沒有響應

  • February 18, 2013

大約 2 個月前,我在 nginx 設置上遷移到 php5-fpm。一切都很好,直到幾天前,我注意到我的 php 網站沒有響應(瀏覽器只是等待數據並最終超時)。重新啟動 php5-fpm 有幫助。這是我的 /var/log/php5-fpm.log 的結尾:

[09-Feb-2013 07:22:46] NOTICE: [pool www] child 26802 started
[09-Feb-2013 20:09:07] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[10-Feb-2013 07:22:40] WARNING: [pool www] child 5986 exited on signal 11 (SIGSEGV - core dumped) after 40414.794799 seconds from start
[10-Feb-2013 07:22:40] NOTICE: [pool www] child 13596 started
[11-Feb-2013 07:22:14] WARNING: [pool www] child 23530 exited on signal 11 (SIGSEGV - core dumped) after 36419.156740 seconds from start
[11-Feb-2013 07:22:14] NOTICE: [pool www] child 31088 started
[12-Feb-2013 06:25:07    [09-Feb-2013 20:09:07] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[10-Feb-2013 07:22:40] WARNING: [pool www] child 5986 exited on signal 11 (SIGSEGV - core dumped) after 40414.794799 seconds from start
[10-Feb-2013 07:22:40] NOTICE: [pool www] child 13596 started
[11-Feb-2013 07:22:14] WARNING: [pool www] child 23530 exited on signal 11 (SIGSEGV - core dumped) after 36419.156740 seconds from start
[11-Feb-2013 07:22:14] NOTICE: [pool www] child 31088 started
[12-Feb-2013 06:25:07] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[12-Feb-2013 07:22:34] WARNING: [pool www] child 20736 exited on signal 11 (SIGSEGV - core dumped) after 3448.720422 seconds from start
[12-Feb-2013 07:22:34] NOTICE: [pool www] child 23808 started
[13-Feb-2013 06:57:30] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 07:21:48] WARNING: [pool www] child 13307 exited on signal 11 (SIGSEGV - core dumped) after 1459.134695 seconds from start
[13-Feb-2013 07:21:48] NOTICE: [pool www] child 13596 started
[13-Feb-2013 08:18:13] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 11:14:49] NOTICE: Finishing ...
[13-Feb-2013 11:14:49] NOTICE: exiting, bye-bye!
[13-Feb-2013 11:14:50] NOTICE: fpm is running, pid 16123
[13-Feb-2013 11:14:50] NOTICE: ready to handle connections
[13-Feb-2013 15:21:53] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[14-Feb-2013 07:22:23] WARNING: [pool www] child 27208 exited on signal 11 (SIGSEGV - core dumped) after 17743.276891 seconds from start
[14-Feb-2013 07:22:23] NOTICE: [pool www] child 31521 started
[14-Feb-2013 15:21:33] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[15-Feb-2013 07:21:51] WARNING: [pool www] child 9699 exited on signal 11 (SIGSEGV - core dumped) after 36679.697975 seconds from start
[15-Feb-2013 07:21:51] NOTICE: [pool www] child 16671 started
[15-Feb-2013 09:35:35] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[16-Feb-2013 07:22:18] WARNING: [pool www] child 29553 exited on signal 11 (SIGSEGV - core dumped) after 22986.940724 seconds from start
[16-Feb-2013 07:22:18] NOTICE: [pool www] child 1459 started
[17-Feb-2013 07:21:42] WARNING: [pool www] child 10229 exited on signal 11 (SIGSEGV - core dumped) after 45737.338223 seconds from start
[17-Feb-2013 07:21:42] NOTICE: [pool www] child 18539 started
[17-Feb-2013 08:19:01] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[17-Feb-2013 22:27:30] NOTICE: Finishing ...
[17-Feb-2013 22:27:31] NOTICE: exiting, bye-bye!
[17-Feb-2013 22:27:31] NOTICE: fpm is running, pid 24139
[17-Feb-2013 22:27:31] NOTICE: ready to handle connections] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[12-Feb-2013 07:22:34] WARNING: [pool www] child 20736 exited on signal 11 (SIGSEGV - core dumped) after 3448.720422 seconds from start
[12-Feb-2013 07:22:34] NOTICE: [pool www] child 23808 started
[13-Feb-2013 06:57:30] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 07:21:48] WARNING: [pool www] child 13307 exited on signal 11 (SIGSEGV - core dumped) after 1459.134695 seconds from start
[13-Feb-2013 07:21:48] NOTICE: [pool www] child 13596 started
[13-Feb-2013 08:18:13] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 11:14:49] NOTICE: Finishing ...
[13-Feb-2013 11:14:49] NOTICE: exiting, bye-bye!
[13-Feb-2013 11:14:50] NOTICE: fpm is running, pid 16123
[13-Feb-2013 11:14:50] NOTICE: ready to handle connections
[13-Feb-2013 15:21:53] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[14-Feb-2013 07:22:23] WARNING: [pool www] child 27208 exited on signal 11 (SIGSEGV - core dumped) after 17743.276891 seconds from start
[14-Feb-2013 07:22:23] NOTICE: [pool www] child 31521 started
[14-Feb-2013 15:21:33] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[15-Feb-2013 07:21:51] WARNING: [pool www] child 9699 exited on signal 11 (SIGSEGV - core dumped) after 36679.697975 seconds from start
[15-Feb-2013 07:21:51] NOTICE: [pool www] child 16671 started
[15-Feb-2013 09:35:35] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[16-Feb-2013 07:22:18] WARNING: [pool www] child 29553 exited on signal 11 (SIGSEGV - core dumped) after 22986.940724 seconds from start
[16-Feb-2013 07:22:18] NOTICE: [pool www] child 1459 started
[17-Feb-2013 07:21:42] WARNING: [pool www] child 10229 exited on signal 11 (SIGSEGV - core dumped) after 45737.338223 seconds from start
[17-Feb-2013 07:21:42] NOTICE: [pool www] child 18539 started
[17-Feb-2013 08:19:01] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[17-Feb-2013 22:27:30] NOTICE: Finishing ...
[17-Feb-2013 22:27:31] NOTICE: exiting, bye-bye!
[17-Feb-2013 22:27:31] NOTICE: fpm is running, pid 24139
[17-Feb-2013 22:27:31] NOTICE: ready to handle connections

“Finishing…”行是我手動重新啟動 php5-fpm 服務時出現的。我知道這不是很多資訊。請告訴我還需要什麼。

可能是什麼問題?

此日誌中顯示了兩個不同且不同的問題。

  1. pm.max_children設置得太低。這控制將產生多少 PHP 程序來處理同時傳入的請求。如果進入的請求多於可用的子請求,則新連接必須等待……最終它們將永遠等待。提高這個值;找到它/etc/php-fpm.d/www.conf

這是您目前問題的實際原因,儘管您可能還沒有註意到一些更隱蔽的問題…… 2. child ... exited on signal 11表示 PHP 在服務請求時崩潰。根據崩潰處理時間,這可能沒有明顯的影響,或者可能導致空白頁面、中止傳輸、使用者神秘註銷等。考慮將 PHP 更新到最新的點版本(5.3.x 或 5.4.x ) 並刪除或替換已知的有問題的擴展,例如 APC。

引用自:https://serverfault.com/questions/479791