2016-09-14 5 views
0

メインのPHPサーバで問題が発生しました。メインのphp5-fpmプロセスはHUPシグナルで終了します。メインプロセスが終了した後、再生成に失敗します。各子プロセスは特定の数の要求を処理することのみが許可されているため、他の子プロセスを生成することなく最終的には終了します。これにより、サーバーが停止し、ユーザーがサーバーから502応答を受け取ることになります。私は当初、その5未満php5-fpm、HUPによって殺されましたシグナル:メインプロセスが再生成に失敗しました

Sep 14 11:41:41 ubuntu kernel: [ 3699.092724] init: php5-fpm main process (3592) killed by HUP signal 
Sep 14 11:41:41 ubuntu kernel: [ 3699.092740] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.160940] init: php5-fpm main process (3611) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.160954] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.216950] init: php5-fpm main process (3619) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.216966] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.283573] init: php5-fpm main process (3627) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.283590] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.337563] init: php5-fpm main process (3635) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.337579] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.385293] init: php5-fpm main process (3643) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.385305] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.430903] init: php5-fpm main process (3651) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.430913] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.482790] init: php5-fpm main process (3659) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.482800] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.532239] init: php5-fpm main process (3667) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.532249] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.595810] init: php5-fpm main process (3675) terminated with status 78 
Sep 14 11:41:42 ubuntu kernel: [ 3699.595825] init: php5-fpm main process ended, respawning 
Sep 14 11:41:42 ubuntu kernel: [ 3699.648253] init: php5-fpm main process (3683) terminated with status 78 
Sep 14 11:41:42 ubuntu0 kernel: [ 3699.648265] init: php5-fpm respawning too fast, stopped 

場合は検索した後私の成り上がりスクリプトの設定

# php5-fpm - The PHP FastCGI Process Manager 

description "The PHP FastCGI Process Manager" 
author "Ondřej Surý <[email protected]>" 

start on runlevel [2345] 
stop on runlevel [016] 

# Precise upstart does not support reload signal, and thus rejects the 
# job. We'd rather start the daemon, instead of forcing users to 
# reboot https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1272788 
# 
#reload signal USR2 

pre-start exec /usr/lib/php5/php5-fpm-checkconf 

respawn 
exec /usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf 

答えて

2

PHPプロセスのスレッド数をチェックしてから再起動しますcronのを持っていることで、この問題を解決することができましたインターネットは最終的に/etc/init/php5-fpm.conf

# php5-fpm - The PHP FastCGI Process Manager 

description "The PHP FastCGI Process Manager" 
author "Ondřej Surý <[email protected]>" 

start on runlevel [2345] 
stop on runlevel [016] 

# Precise upstart does not support reload signal, and thus rejects the 
# job. We'd rather start the daemon, instead of forcing users to 
# reboot https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1272788 
# 
#reload signal USR2 

pre-start exec /usr/lib/php5/php5-fpm-checkconf 
pre-start exec /bin/bash /etc/init/php5-fpm.sh 
post-start exec /bin/bash /etc/init/php5-fpm-onstart.sh 

respawn 
exec /usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf 

php5-fpmの成り上がりスクリプトを修正することにより、これに対する解決策を得ることができたので、追加のスクリップを追加しましたphp5-fpm.confには、pre-startpost-startがあります。 pre-startスクリプトは、スクリプトは基本的にmain process PIDとsockファイルを削除

#!/bin/bash 
rm /var/run/php5-fpm.pid 
rm /var/run/php5-fpm.sock 
CHILD_PIDS_FILE="/var/run/php5-fpm-child.pid" 
CHILD_PIDS=`ps -ef | grep 'php' | grep -v grep |awk '{print $2}'` 
echo "$CHILD_PIDS" > "$CHILD_PIDS_FILE" 

です。新しいphp5-fpmプロセスが作成されると、子プロセスのpidをファイルに書き込んで、それらをkillすることができます。

post-startスクリプトはpost-startスクリプトがphp5-fpmを再起動する前に実行していたすべての子-PIDを削除

#!/bin/bash 
CHILD_PIDS_FILE="/var/run/php5-fpm-child.pid" 
while read PID; do 
    kill -9 $PID 
done < $CHILD_PIDS_FILE 
>$CHILD_PIDS_FILE 

です。

関連する問題