Skip to content

[6.x] Fork workers with the StreamSelectDriver event loop - #14750

Merged
orklah merged 1 commit into
vimeo:6.xfrom
zonuexe:fix/event-loop-driver-fork
Nov 23, 2026
Merged

orklah merged 1 commit into
vimeo:6.xfrom
zonuexe:fix/event-loop-driver-fork

Conversation

@zonuexe

@zonuexe zonuexe commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Backports #14238 from master to 6.x.

On PHP 8.6 with revolt/event-loop 1.1.0, EventLoop defaults to IoPollDriver (Io\Poll, epoll on Linux / kqueue on macOS). When Pool forks workers via pcntl_fork(), the parent and workers end up sharing/inheriting a kernel poller handle (causing segfaults on Linux epoll, or hangs / Io\Poll\FailedPollWaitException on macOS kqueue because kqueue descriptors are not inherited across fork()).

This switches the event loop driver to StreamSelectDriver before forking when the active driver holds a kernel handle ($driver->getHandle() !== null), and fails with a clear message suggesting REVOLT_DRIVER or --threads=1 if the loop is already running.

The unit test in tests/Internal/Fork/PoolEventLoopDriverTest.php wraps StreamSelectDriver to simulate a non-null kernel handle rather than referencing IoPollDriver directly, so it runs across all PHP versions (8.1–8.6) and both revolt/event-loop 1.0.x and 1.1.x without skipping or triggering UndefinedClass when revolt/event-loop 1.0.x is installed.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Performance: unchanged · Issues: unchanged

Project Memory (MB) Wall (s) Issues Weighted
⚠️ drupal – – – –
✅ laravel 1 006 81.7 $\color{gray}{\textsf{+6.0\%}}$ 25 554 51 698
✅ symfony 1 512 67.1 $\color{gray}{\textsf{-0.5\%}}$ 44 001 89 327
✅ doctrine-orm 260 11.3 $\color{gray}{\textsf{-1.2\%}}$ 3 538 5 602
✅ psl 570 16.9 $\color{gray}{\textsf{+1.1\%}}$ 1 583 6 572
✅ phpunit 340 12.1 $\color{gray}{\textsf{-0.2\%}}$ 1 628 1 351
✅ php-parser 199 13.0 $\color{gray}{\textsf{-0.1\%}}$ 17 186 20 675
✅ amphp-amp 52 $\color{gray}{\textsf{+0.1\%}}$ 1.8 $\color{gray}{\textsf{-2.2\%}}$ 32 79
✅ webmozarts-assert 213 3.7 577 2 705
✅ guzzle-promises 47 $\color{gray}{\textsf{+0.1\%}}$ 1.8 $\color{gray}{\textsf{-0.5\%}}$ 164 405
Total 4 200 209.5 $\color{gray}{\textsf{+2.1\%}}$ 94 263 178 414
How to read this table
  • Memory: Psalm's own peak figure, threads=1. More than +5 % fails, unless the PR changes composer.json.
  • Wall: base and head run on the same runner; ±10 % is noise. Above +20 % warns, never fails. re-run: a reversed second run was taken and the faster kept.
  • Issues: head count, then $\color{red}{\textsf{+added}}$ $\color{green}{\textsf{-removed}}$ against base.
  • Weighted: issues weighted by error level (levels 1–8 as is, always-errors 10, feature-specific and purity suggestions 0). The projects' own code is pinned and their dependencies resolve identically for base and head, so a change means Psalm reports more, fewer or differently serious issues. A rise is not necessarily a regression.
  • Total: sum over the projects compared on both sides. Thresholds apply per project, not to the total.
  • Colors: $\color{red}{\textsf{red}}$ past a fail or warn threshold (or more issues), $\color{green}{\textsf{green}}$ an improvement past noise (or fewer issues), $\color{gray}{\textsf{gray}}$ noise.
  • Performance: regressed if a head run crashed or timed out or a memory or wall delta is red, else improved if one is green, else unchanged. Its icon is the check result: ❌ fail · ⚠️ warn · ✅ pass; the icon next to each project is that project's result, 💥 = not comparable: base crashed or timed out (counts as ⚠️).
  • Issues (heading): the total weighted change, increased · decreased · unchanged. Informational, never fails the check.

⚠️ drupal: base: install failed: - Root composer.json requires drupal/core 11.4.11 (exact version match: 11.4.11 or 11.4.11.0), found drupal/core[11.4.11] but these were not loaded, because they are affected by security advisories ("SA-CORE-2026-017", "SA-CORE-2026-018"). Review the advisory details above for more information.

head 090055a · base 9fbfcc1 (merge-base) · workflow run

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 23, 2026
@orklah
orklah merged commit 7202321 into vimeo:6.x Nov 23, 2026
71 of 72 checks passed
@orklah

orklah commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

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

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants