Skip to content

PHPUnit process isolation (@runInSeparateProcess) silently dies in the managed WordPress sandbox — child exits with no stderr and no result file #2485

Description

@chubes4

Symptom

Every @runInSeparateProcess / @runTestsInSeparateProcesses test in Extra-Chill/extrachill-users fails in CI (managed sandbox, wp_codebox_phpunit_bootstrap_mode: managed) with:

Test was run in child process and ended unexpectedly

Reproduced with a minimal probe — a noop isolated test dies identically:

class Test_Isolation_Probe extends WP_UnitTestCase {
    /** @runInSeparateProcess @preserveGlobalState disabled */
    public function test_noop_in_separate_process(): void { $this->assertTrue( true ); }
}

Evidence: Extra-Chill/extrachill-users#391 (19 tests across 5 classes), probe at branch fix-391-test-baseline (commit 5d389b5), GitHub run 34170973133.

Diagnosis

Per PHPUnit 9's AbstractPhpProcess::processChildResult() (vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:276-309), this failure means BOTH:

  • child stderr was empty — no PHP fatal occurred (the child template sets display_errors=stderr before autoload, so any fatal would surface), and
  • the child result file was never written — the child exited or was killed before file_put_contents(processResultFile) at the end of __phpunit_run_isolated_test().

The child runs php with the template job on STDIN (DefaultPhpProcess::runProcessproc_open), bare ini, then requires the composer autoload plus $GLOBALS['__PHPUNIT_BOOTSTRAP'] (the managed bootstrap) before running the test. A silent death with no output points at an exit() in the child bootstrap path or a process kill — not a PHP error.

What it breaks

  • 19 tests in extrachill-users cannot run in CI at all.
  • Any future test using process isolation in any repo on this harness hits the same wall.

Ask

Investigate the child-process path in the sandbox: whether proc_open/STDIN execution of the PHPUnit template is permitted, whether the managed bootstrap exits early when re-run in a child context, and whether the result temp file (parent sys_get_temp_dir()) is writable from the child's mount namespace.

Repro: push a noop @runInSeparateProcess test on any repo configured with wp_codebox_phpunit_bootstrap_mode: managed.

Filed from Extra-Chill/extrachill-users#391 / PR Extra-Chill/extrachill-users#393.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions