php / php/php-src

JIT bug: composer install sometimes hangs

Open
#22,086 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: JIT Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked composer-hang-repro repository and start by building Dockerfile.jit and Dockerfile.nojit, then run loop.sh to compare repeated Composer installs. Read the README and inspect the PHP JIT/OPcache behavior involved in the tracing configuration. Done means the demonstrated hangs are understood and no longer occur under the reproducer with tracing enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.