Skip to content

fix: deliver pending utilityProcess messages before emitting exit - #54956

Merged
ckerr merged 1 commit into
45-x-yfrom
manual-bp/claude/pr/54924/branch/45-x-y
Oct 15, 2026
Merged

ckerr merged 1 commit into
45-x-yfrom
manual-bp/claude/pr/54924/branch/45-x-y

Conversation

@claude

@claude claude Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Description of Change

Manually backport #54924. See that PR for details.

The only conflict was in HandleTermination() in shell/browser/api/electron_api_utility_process.cc, where 45-x-y lacks the BrowserChildProcessObserver bookkeeping from #53992, so the new DispatchPendingMessages() call was placed before CloseConnectorPort() without that line; all spec changes applied cleanly.

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_01LPMvJBQiyP6b7QjatACmnS

Release Notes

Notes: Fixed utilityProcess dropping messages posted with process.parentPort.postMessage() right before the process exits.


Generated by Claude Code

…4924)

* fix: deliver pending utilityProcess messages before emitting exit

HandleTermination closed the parentPort connector before emitting 'exit',
so messages the child had posted but the browser had not dispatched yet
were dropped. The connector dispatches one message per task, and the exit
notification can already be queued ahead of those tasks, so a child that
posts several messages and then calls process.exit() lost all but the
first.

Dispatch whatever is already queued on the port before closing it. Browser
shutdown still closes the port without dispatching, since the child is
still running then.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LPMvJBQiyP6b7QjatACmnS

* test: extract sleepSync helper and drop utility-process ack handshake

Move the Atomics.wait() call in the utilityProcess message-before-exit
test into a documented sleepSync() spec helper.

With pending parentPort messages now dispatched before 'exit', the
api-net-spec.js fixture can post its result and exit right away again,
so remove the ack handshake that #54901 added as a workaround, along
with the error logging that covered the wait for the ack.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LPMvJBQiyP6b7QjatACmnS

(cherry picked from commit 4a802b0)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LPMvJBQiyP6b7QjatACmnS
@trop
trop Bot requested review from dsanders11 and jkleinsc October 14, 2026 23:06
@trop trop Bot added 45-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Oct 14, 2026
@claude claude Bot added target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Oct 14, 2026
@ckerr
ckerr merged commit 53d6d27 into 45-x-y Oct 15, 2026
105 checks passed
@ckerr
ckerr deleted the manual-bp/claude/pr/54924/branch/45-x-y branch October 15, 2026 00:32
@release-clerk

release-clerk Bot commented Oct 15, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed utilityProcess dropping messages posted with process.parentPort.postMessage() right before the process exits.

@trop

trop Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Oct 15, 2026
@trop

trop Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54960

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

Labels

45-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes target/44-x-y PR should also be added to the "44-x-y" branch.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants