php / php/php-src

JIT causes non-deterministic results in Composer's SAT dependency resolver

Open
#21,079 0 comments 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

When JIT is enabled with opcache.jit=tracing, Composer's dependency resolver (SAT solver) produces non-deterministic results. The same composer update command with identical inputs sometimes succeeds and sometimes fails with a bogus dependency conflict.

Disabling JIT makes the issue disappear completely.

Reproducer:

git clone -b chore/jit-bug-composer https://github.com/sanmai/pipeline.git                                                                                                                                                                                              
cd pipeline                                                                                                                                                                                                                                                             
./doit2.sh                                                                                                                                                                                                                                                              

I'm looking at this error when it fails:

Running pool optimizer.
Updating dependencies
Generating rules
Resolving dependencies through SAT

Dependency resolution completed in 0.615 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires phpunit/phpunit ^11 || ^12 -> satisfiable by phpunit/phpunit[11.5.50, 12.5.8].
    - phpunit/phpunit[11.5.50, 12.5.8] require staabm/side-effects-detector ^1.0.5 -> satisfiable by staabm/side-effects-detector[1.0.5].
    - Conclusion: don't install staabm/side-effects-detector 1.0.5 (conflict analysis result)

Without JIT, it works like a clock.

PHP Version
PHP 8.5.2 (cli) (built: Jan 16 2026 23:13:28) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.2, Copyright (c), by Zend Technologies
Operating System

No response

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 reproducer, check out chore/jit-bug-composer, and run ./doit2.sh with opcache.jit=tracing enabled and disabled. Compare the Composer SAT resolver results across repeated runs, then trace the PHP OPcache JIT path involved. Done means identical inputs produce a stable successful resolution with JIT enabled rather than a bogus conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.