fix(miniflare): disable per-browser SIGINT/SIGHUP to allow full multi-session teardown (Closes #15419) - #15431
ravendevhub wants to merge 2 commits into
Conversation
…-session teardown (Closes cloudflare#15419)
🦋 Changeset detectedLatest commit: 440c633 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
petebacondarwin
left a comment
There was a problem hiding this comment.
Requesting changes because browser processes that are still launching are not covered by the new teardown path.
Puppeteer signal handling is disabled before launchBrowser() completes, but Miniflare does not register the process with its exit hook until after that function returns. If SIGINT or SIGHUP arrives during concurrent launches, those processes are invisible to the Miniflare hook and a detached browser child can survive.
Please track every process immediately when it is launched, including retry attempts, and unregister it on exit or launch failure. Add regression coverage for multiple established sessions and concurrent pending launches under SIGINT and SIGHUP.
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
Fixes #15419
Summary
When a local Browser Rendering Worker has more than one active Chrome session, sending
SIGINTdirectly to the Wrangler Node process terminates Wrangler and kills only the first Chrome process tree, leaving remaining Chrome process trees orphaned (reparented to PID 1).Solution
handleSIGINT: falseandhandleSIGHUP: falseto@puppeteer/browsers'slaunch()options inpackages/miniflare/src/plugins/browser-rendering/index.ts.exitHookinpackages/miniflare/src/index.ts, synchronously terminate all tracked active browser processes in#browserProcessesbefore the process exits..changeset/fix-browser-rendering-sigint.md.