Skip to content

Close Chrome process pipes before termination to prevent loop hang#94

Merged
lippserd merged 1 commit into
mainfrom
fix-chrome-process-termination
Jun 25, 2026
Merged

Close Chrome process pipes before termination to prevent loop hang#94
lippserd merged 1 commit into
mainfrom
fix-chrome-process-termination

Conversation

@lippserd

Copy link
Copy Markdown
Member

Chrome spawns renderer and utility sub-processes that inherit the open stdin, stdout, and stderr pipes of the main browser process. When only the main process is terminated via Process::terminate(), those child processes keep the inherited file descriptors open. ReactPHP's event loop stays alive watching those streams, so Loop::run() never returns and PDF generation hangs indefinitely.

Close all process pipes explicitly before calling terminate() so the event loop has no remaining streams to watch and can exit cleanly.

Chrome spawns renderer and utility sub-processes that inherit the open
stdin, stdout, and stderr pipes of the main browser process. When only
the main process is terminated via `Process::terminate()`, those child
processes keep the inherited file descriptors open. ReactPHP's event
loop stays alive watching those streams, so `Loop::run()` never returns
and PDF generation hangs indefinitely.

Close all process pipes explicitly before calling `terminate()` so the
event loop has no remaining streams to watch and can exit cleanly.

Co-authored-by: OoYo0uto <253079834+OoYo0uto@users.noreply.github.com>
@cla-bot cla-bot Bot added the cla/signed label Jun 25, 2026
@lippserd lippserd linked an issue Jun 25, 2026 that may be closed by this pull request
@lippserd lippserd merged commit 395eb46 into main Jun 25, 2026
13 checks passed
@lippserd lippserd deleted the fix-chrome-process-termination branch June 25, 2026 08:02
@lippserd lippserd added this to the 0.13.0 milestone Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pdf export with local chromium did not terminate

1 participant