Skip to content

fix(miniflare): disable per-browser SIGINT/SIGHUP to allow full multi-session teardown (Closes #15419) - #15431

Open
ravendevhub wants to merge 2 commits into
cloudflare:mainfrom
ravendevhub:fix/issue-15419
Open

ravendevhub wants to merge 2 commits into
cloudflare:mainfrom
ravendevhub:fix/issue-15419

Conversation

@ravendevhub

@ravendevhub ravendevhub commented Aug 30, 2026 •

Copy link
Copy Markdown

Fixes #15419

Summary

When a local Browser Rendering Worker has more than one active Chrome session, sending SIGINT directly 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

  • Explicitly passed handleSIGINT: false and handleSIGHUP: false to @puppeteer/browsers's launch() options in packages/miniflare/src/plugins/browser-rendering/index.ts.
  • In Miniflare's exitHook in packages/miniflare/src/index.ts, synchronously terminate all tracked active browser processes in #browserProcesses before the process exits.
  • Added patch changeset in .changeset/fix-browser-rendering-sigint.md.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: Disables per-process signal handling in @puppeteer/browsers to allow Miniflare's centralized exitHook teardown to manage process lifecycle.
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Internal process lifecycle and signal handling fix in Miniflare.

@changeset-bot

changeset-bot Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 440c633

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
miniflare Patch
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
wrangler Patch

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 30, 2026
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team August 30, 2026 10:45
@workers-devprod

workers-devprod commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/fix-browser-rendering-sigint.md: [@cloudflare/wrangler]
  • packages/miniflare/src/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/browser-rendering/index.ts: [@cloudflare/wrangler]

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15431

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15431

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15431

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15431

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15431

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15431

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15431

miniflare

npm i https://pkg.pr.new/miniflare@15431

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15431

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15431

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15431

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15431

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15431

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15431

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15431

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15431

wrangler

npm i https://pkg.pr.new/wrangler@15431

commit: 440c633

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Sep 8, 2026
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/fix-browser-rendering-sigint.md: [@cloudflare/wrangler]
  • packages/miniflare/src/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/browser-rendering/index.ts: [@cloudflare/wrangler]

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

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Miniflare Browser Rendering leaves all but the first Chrome orphaned on direct SIGINT

3 participants