php / php/php-src

JIT bug: composer install sometimes hangs

未关闭
#22,086 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Category: JIT Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

composer install sometimes hangs when JIT is on and set to tracing. I created a reproducing repo that shows the problem: https://github.com/ondrejmirtes/composer-hang-repro

Disclaimer: Claude Code helped me create the reproducer. The repo contains two Dockerfiles (with JIT on/off) that shows the difference in behaviour and loop.sh script that runs composer install over and over and shows that it hangs in about 3 % of performed runs.

There are some details in the README but consider them with a grain of salt.

To reproduce the problem in the cloned link repository:

# Build both images (PHP 8.5.6 + Composer 2.9.5)
docker build -t composer-jit-hang  -f Dockerfile.jit  .
docker build -t composer-jit-nojit -f Dockerfile.nojit .

# 1) See the hang with opcache.jit=tracing.
#    loop.sh bootstraps vendor/ on first run (one ~30 s install to bring in
#    Symfony Flex, which has to be loaded as a plugin for the JIT bug to
#    fire), then runs `composer install --dry-run` 200 times. Expect a
#    handful of those runs to be killed at the 15 s deadline — last
#    measurement: 19 hangs in 500 runs.
docker run --rm \
  -v "$PWD":/work \
  composer-jit-hang bash /loop.sh 200

# 2) Same project, same Composer, same PHP, JIT off — zero hangs.
docker run --rm \
  -v "$PWD":/work \
  composer-jit-nojit bash /loop.sh 200
PHP Version
PHP 8.5.6 (cli) (built: May  8 2026 19:23:57) (NTS)
     Copyright (c) The PHP Group
     Built by https://github.com/docker-library/php
Operating System

Debian 13.4

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

克隆链接的 composer-hang-repro 仓库,首先构建 Dockerfile.jit 和 Dockerfile.nojit,然后运行 loop.sh 以比较重复的 Composer 安装。阅读 README,并检查 tracing 配置中涉及的 PHP JIT/OPcache 行为。当已演示的挂起现象得到理解,并且在启用 tracing 的 reproducer 中不再发生时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, php
领域
compilers, performance
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。