Skip to content

fix: tear down Node's per-process state before the process exits - #52870

Merged
MarshallOfSound merged 2 commits into
43-x-yfrom
trop/43-x-y-bp-fix-tear-down-node-s-per-process-state-before-the-process-exits-1786912893686
Aug 16, 2026
Merged

MarshallOfSound merged 2 commits into
43-x-yfrom
trop/43-x-y-bp-fix-tear-down-node-s-per-process-state-before-the-process-exits-1786912893686

Conversation

@trop

@trop trop Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Backport of #52856

See that PR for details.

Notes: Fixed a possible crash (SIGABRT) during process exit when the process had loaded tls/https shortly before exiting, affecting app.exit() before ready and short-lived ELECTRON_RUN_AS_NODE / child_process.fork() scripts.

trop Bot and others added 2 commits August 16, 2026 20:41
Loading `tls` makes Node start a background thread that parses the CA
certificates. Node joins that thread in TearDownOncePerProcess(), which
Electron never called, so a process that loaded tls/https and exited soon
after could have exit() destroy Node's static mutexes underneath that
thread and abort().

Call node::TearDownOncePerProcess() at the end of the ELECTRON_RUN_AS_NODE
entry point, from the NodeBindings instance that initialized Node (browser
and utility processes), and before the direct exit() that app.exit() takes
when called before 'ready'.

Co-authored-by: Sam Attard <[email protected]>
That path exits with browser start-up state still allocated, so
LeakSanitizer reports it and replaces the exit code the spec asserts on.

No-Verification-Needed: test-only change (spec/api-app-spec.ts)

Co-authored-by: Sam Attard <[email protected]>
@trop
trop Bot requested a review from MarshallOfSound August 16, 2026 20:41
@trop trop Bot added 43-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Aug 16, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) August 16, 2026 20:42
@MarshallOfSound
MarshallOfSound merged commit 76db1b2 into 43-x-y Aug 16, 2026
95 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/43-x-y-bp-fix-tear-down-node-s-per-process-state-before-the-process-exits-1786912893686 branch August 16, 2026 22:34
@release-clerk

release-clerk Bot commented Aug 16, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a possible crash (SIGABRT) during process exit when the process had loaded tls/https shortly before exiting, affecting app.exit() before ready and short-lived ELECTRON_RUN_AS_NODE / child_process.fork() scripts.

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

Labels

43-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant