Skip to content

fix: crash on windows when v8 posts a delayed worker task during shutdown - #52956

Merged
codebytere merged 1 commit into
mainfrom
fix-node-platform-late-delayed-post
Aug 19, 2026
Merged

fix: crash on windows when v8 posts a delayed worker task during shutdown#52956
codebytere merged 1 commit into
mainfrom
fix-node-platform-late-delayed-post

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Backports nodejs/node#61999.

NodePlatform's DelayedTaskScheduler closes its uv loop when the worker thread task runner shuts down, but a task still running on a platform worker thread (V8's MemoryPool release task re-posts itself with a delay) could call PostDelayedTask() after that. The call reaches uv_async_send() on a closed handle; on Windows libuv then fails PostQueuedCompletionStatus() against the destroyed completion port and calls uv_fatal_error(), so the process dies at quit.

Late posts are now dropped once the scheduler has been stopped, matching what PerIsolatePlatformData already does for foreground tasks. The patch can be removed once Electron rolls a Node release that contains nodejs/node#61999.

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • PR title follows semantic commit guidelines

Release Notes

Notes: Fixed a crash on Windows when V8 posted a delayed worker task during shutdown.

@codebytere
codebytere requested a review from a team as a code owner August 18, 2026 12:24
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. labels Aug 18, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 18, 2026
…down

Backports nodejs/node#61999.

NodePlatform's DelayedTaskScheduler closes its uv loop when the worker
thread task runner shuts down, but a task still running on a platform
worker thread (V8's MemoryPool release task re-posts itself with a
delay) could call PostDelayedTask() after that. The call reaches
uv_async_send() on a closed handle; on Windows libuv then fails
PostQueuedCompletionStatus() against the destroyed completion port and
calls uv_fatal_error(). Late posts are now dropped once the scheduler
has been stopped, matching what PerIsolatePlatformData already does for
foreground tasks.
@codebytere
codebytere force-pushed the fix-node-platform-late-delayed-post branch from 48caebb to d0fd686 Compare August 18, 2026 12:47
@codebytere
codebytere merged commit cbdd9d7 into main Aug 19, 2026
78 checks passed
@codebytere
codebytere deleted the fix-node-platform-late-delayed-post branch August 19, 2026 07:39
@release-clerk

release-clerk Bot commented Aug 19, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a crash on Windows when V8 posted a delayed worker task during shutdown.

@trop

trop Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added in-flight/42-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. and removed target/43-x-y PR should also be added to the "43-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/42-x-y in-flight/43-x-y labels Aug 19, 2026
@codebytere

Copy link
Copy Markdown
Member Author

/trop run backport-to 44-x-y

@trop

trop Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

The backport process for this PR has been manually initiated - sending your PR to 44-x-y!

@trop

trop Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added in-flight/44-x-y merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/44-x-y labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants