PHP 8.2 FPM Leaks processes on pcntl_fork
还没有人认领这个 Issue。
评估
调研方向
从提供的 Drupal 10 index.php 复现代码开始,重点关注 pcntl_fork() 调用和 PHP-FPM 进程的行为。使用 Ubuntu 16.04 上的 PHP 8.2.10 复现,并与 PHP 7.4 进行比较。当 fork 出的进程在 sleep 后被清理,而不是脱离并继续存在于 FPM master 进程下时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Description
OS: xenial
PHP tested: 8.2.7, 8.2.10
The following drupal 10 index.php:
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$kernel = new DrupalKernel('prod', $autoloader);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$pid = pcntl_fork();
if ( $pid !== 0 ) {
// we are the parent process
return;
}
sleep(10);
$kernel->terminate($request, $response);
After doing ~5 requests to the site, results in the following sub-processes to the FPM master:
root 15873 0.0 0.8 464188 17200 ? Ss 13:08 0:00 php-fpm: master process (/var/www/site-fpm/drush12test.prod/php-fpm-8.2.conf)
drush12+ 16518 0.7 1.4 466300 29860 ? S 13:11 0:00 \_ php-fpm: pool drush12test
drush12+ 16557 0.0 0.6 466300 13068 ? S 13:11 0:00 \_ php-fpm: pool drush12test
drush12+ 16559 0.0 0.6 466300 12640 ? S 13:11 0:00 \_ php-fpm: pool drush12test
drush12+ 16561 0.0 0.6 466300 12640 ? S 13:11 0:00 \_ php-fpm: pool drush12test
drush12+ 16563 0.0 0.6 466300 12640 ? S 13:11 0:00 \_ php-fpm: pool drush12test
But then after a few seconds, when it should clean them up, they will instead detach and linger around:
root 15873 0.0 0.8 464188 17188 ? Ss 13:08 0:00 php-fpm: master process (/var/www/site-fpm/drush12test.prod/php-fpm-8.2.conf)
drush12+ 16557 0.0 1.1 464252 23364 ? S 13:11 0:00 php-fpm: pool drush12test
drush12+ 16559 0.0 1.1 464252 23028 ? S 13:11 0:00 php-fpm: pool drush12test
drush12+ 16561 0.0 1.1 464252 23028 ? S 13:11 0:00 php-fpm: pool drush12test
drush12+ 16563 0.0 1.1 466300 23432 ? S 13:11 0:00 php-fpm: pool drush12test
The same doesn't happen with PHP 7.4. In that case the processes get cleaned up properly.
PHP Version
PHP 8.2.10
Operating System
Ubuntu 16.04
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 103
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
Bug SAPI: cli_server Status: Verified
难度 2/5 1-3 小时 新手友好度 88/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 76/100
-
Bug Status: Needs Triage
难度 1/5 1 小时以内 新手友好度 90/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
-
Bug Category: Tests Status: Verified
难度 2/5 1-3 小时 新手友好度 68/100
相似的 Issue
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
HarbourMasters/Shipwright#7229 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 条评论 ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 76/100