php / php/php-src

php-fpm trying to kill another user's pool results in an infinite loop and 99% cpu usage

オープン
#8,072 コメント 6 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug SAPI: fpm Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

Hi,

We've come across an interesting issue where an instance of the php-fpm pool ran by one user gets stuck restarting and tries to kill another user's php-fpm pool instances.. similar issue has been described here:

https://bugs.php.net/bug.php?id=74709

Can you please help us fix this? Here's a snippet of strace of the process in question:-

strace: Process 34545 attached
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1, l_len=1, l_pid=32328}) = 0
kill(32328, SIGTERM) = -1 EPERM (Operation not permitted)

the process for which above strace is for is owned by user "xyz", while the process it's trying to kill (process id: 32328) is owned by user "anc".

I would also like to add that this causes all of our websites to timeout. by all websites i mean websites which are using the same php version. like for example the process that's currently stuck and reported in my below mssg is using php 8.0.15 and so all of the websites on my server using php 8.0.15 are timing out.

PHP Version

8.0.15

Operating System

CloudLinux v7.9.0 (CentOS 7)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ソースファイルもテストも特定されていません。まず、CloudLinux v7.9/CentOS 7 上の PHP 8.0.15 で php-fpm pool の再起動を再現し、strace に示されている kill と file-lock の繰り返しシーケンスを調査してください。EPERM の結果によって別のユーザーの pool に影響する無限ループが発生せず、同じ PHP バージョンを使用するサイトが応答し続ければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend, operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。