Review 13.4 Merged

95324[BUGFIX] Avoid deadlock in console command tests

Stefan Bürk CR +2 V +2 Normal +31 −23 updated 08/14/26, 12:52

Commit message

AbstractCommandTestCase::executeConsoleCommand() starts a console
command and then reads its two output pipes strictly one after the
other: stdout is consumed to its end, the handle is closed, and only
then is the same done for stderr.

A pipe holds a limited amount of data, 64 KiB on Linux. A command that
writes more than that to stderr therefore blocks in its own write call
before it has finished, so it never closes stdout, while the test is
still blocked reading stdout and waiting for an end of file that can no
longer arrive. Both sides wait for each other, and neither the reads nor
proc_close bound how long they do so. phpunit has no per test time
limit either, so the whole test run stops at that point and the CI job
only ends when it is killed after 30 minutes.

This has been observed on 14.3 as thirteen job timeouts within three
days, spread over five unrelated changes and over all five runners,
every time in a functional chunk containing CliCommandTest, and always
starting directly after a failing command - which is exactly when a
command turns verbose on stderr.

Use Symfony Process, which consumes both pipes at the same time and
cannot deadlock this way. It is already a dependency and already used
for the same purpose in CommandUtility. Give it an upper limit on the
runtime as well, so a command that never returns fails its own test,
with the output captured so far attached, instead of stalling the run.
The limit is generous, since it exists to end a hang, not to police
runtimes, and is a property so a slow test case can raise it.

The returned array keeps its shape, so the seven test cases using the
helper are unaffected.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
  • Verified V +2 Done
    • Georg Ringer +2
    • core-ci +1 CI

Issues 1

Files 1

Review log 34

  1. Stefan Bürk uploaded patch set 1 08/13/26, 19:07

  2. core-ci voted on patch set 1 V +1 08/13/26, 19:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106674

  3. Georg Ringer voted on patch set 1 CR +2 V +2 08/14/26, 12:52

  4. Georg Ringer merged patch set 2 08/14/26, 12:52