#52956: fix: crash on windows when v8 posts a delayed worker task during shutdown
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 testpasses - PR title follows semantic commit guidelines
Release Notes
Notes: Fixed a crash on Windows when V8 posted a delayed worker task during shutdown.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron