Issue Bug Resolved

#110481Console command test helper can deadlock

Stefan Bürk 08/13/26, 18:46 updated 08/14/26, 12:55

Description

Problem

The functional test helper
TYPO3\CMS\Core\Tests\Functional\Command\AbstractCommandTestCase::executeConsoleCommand()
runs a console command through proc_open and then reads the two output pipes
one after the other. stdout is consumed to its end first, by a plain

bc. stream_get_contents($pipes1)

and only once that call has returned and the handle has been closed is the same
done for stderr on $pipes2.

A pipe only holds a limited amount of data, 64 KiB on Linux. As soon as the
executed command writes more than that to stderr, it blocks in its own write
call and therefore never closes stdout. The test in turn blocks in
stream_get_contents() on stdout, waiting for an end of file that can no longer
arrive. Both sides wait for each other, permanently.

There is no upper limit on the runtime either. Neither stream_get_contents()
nor proc_close bounds how long it waits, and phpunit has no per test timeout,
so a command that does not return stalls the entire test run.

Effect

The run produces no further output and ends only when the CI job is killed
after 30 minutes. Thirteen such job timeouts were recorded within three days on
branch 14.3, spread over five unrelated changes and over all five runners, in
every case in a functional chunk that contains CliCommandTest. The stall always
begins directly after a failing command, and that is precisely the situation
in which a command becomes verbose on stderr.

Solution

Both pipes have to be consumed at the same time, and an upper limit on the
runtime has to be applied, so that a command which hangs fails its own test,
with the output captured so far attached, instead of stalling the whole run.

Affected branches

The helper is identical on main, 14.3 and 13.4, so all three are affected.

Reviews 3

History 14

  1. Stefan Bürk commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-08-14T12:55:12+00:00" > 08/14/26, 12:55 </span>

    Applied in changeset commit:6d943c6170857fec70030991deadd3c5e6da72f7.