Skip to content

Keep the composed ini when a forked worker ends - #6865

Merged
ondrejmirtes merged 3 commits into
2.3.xfrom
restart-forked-worker-keeps-composed-ini
Oct 27, 2026
Merged

ondrejmirtes merged 3 commits into
2.3.xfrom
restart-forked-worker-keeps-composed-ini

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

After the restart (#6773), every PHP process reads the composed ini through PHPRC, with PHP_INI_SCAN_DIR emptied. Forked workers inherited the restarted process's shutdown function that deletes the composed ini, so the first worker to end deleted it while the run was still going.

A PHP process spawned after that, for example by an extension compiling its own DI container, ran with neither the ini nor the scan dir. It missed every extension loaded from conf.d, which surfaced as:

Internal error: DI container compilation of project "slevomat" failed: PHP Fatal error:  Uncaught Error: Call to undefined function mb_internal_encoding()

It only showed up on cold runs, when the spawned process started after a worker had ended.

The first commit adds the tests and is expected to fail:

  • an e2e scenario in the process restart job (pcov restart, forked workers) whose CollectedDataNode rule spawns php in the main process after all workers ended and compares its loaded extensions;
  • a RestartManagerTest case that forks a child which exits normally and checks the ini survives it and is still deleted by its owner.

The second commit makes only the process that registered the shutdown function delete the ini.

A PHP process spawned during the run reads its configuration from the
composed ini through PHPRC. Once a forked worker deletes it, the spawned
process loads neither the ini nor the scan dir, and misses every extension
loaded from them.

Amp-Thread-ID: https://ampcode.com/threads/T-01a17e3b-9bb8-77b1-a5c1-722d8ade601b
Forked workers inherited the shutdown function deleting the composed ini,
so the first one to end deleted it while PHP processes spawned later in the
run still read their configuration from it through PHPRC.

Amp-Thread-ID: https://ampcode.com/threads/T-01a17e3b-9bb8-77b1-a5c1-722d8ade601b
The step already clears it before the scenario runs. Clearing it again
loads the probe through bootstrapFiles in a process that never restarts,
after probe.log was reset.

Amp-Thread-ID: https://ampcode.com/threads/T-01a17e3b-9bb8-77b1-a5c1-722d8ade601b
@ondrejmirtes
ondrejmirtes merged commit 4ef9ab7 into 2.3.x Oct 27, 2026
603 of 604 checks passed
@ondrejmirtes
ondrejmirtes deleted the restart-forked-worker-keeps-composed-ini branch October 27, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant