Skip to content

src: avoid use-after-close of delayed task scheduler async handle - #64492

Closed
PickBas wants to merge 1 commit into
nodejs:mainfrom
JaneaSystems:issue-64322
Closed

src: avoid use-after-close of delayed task scheduler async handle#64492
PickBas wants to merge 1 commit into
nodejs:mainfrom
JaneaSystems:issue-64322

Conversation

@PickBas

Copy link
Copy Markdown
Contributor

src: avoid use-after-close of delayed task scheduler async handle

A worker thread posting a delayed task while the platform is shutting down could call uv_async_send() on the scheduler's async handle after Stop() began closing it, aborting with Assertion failed: !(handle->flags & UV_HANDLE_CLOSING).

This adds a stopped_ flag, guarded by the existing task queue lock, so late PostDelayedTask() calls are dropped instead of racing the handle close. Includes a cctest reproducing the shutdown race.

Fixes: #64322

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jul 14, 2026
Fixes: nodejs#64322
Signed-off-by: StefanStojanovic <stefan.stojanovic@janeasystems.com>
Co-authored-by: Kirill Saied <sayed.kirill@gmail.com>
@codecov

codecovBot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.23%. Comparing base (4140d4c) to head (80d2173).
⚠️ Report is 93 commits behind head on main.

Files with missing linesPatch %Lines
src/node_platform.cc75.00%0 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #64492 +/- ##
==========================================
- Coverage 90.25% 90.23% -0.02% 
==========================================
Files 741 741 Lines 241216 241692 +476 Branches 45442 45552 +110 ==========================================
+ Hits 217713 218101 +388 - Misses 15079 15101 +22 - Partials 8424 8490 +66 
Files with missing linesCoverage Δ
src/node_platform.cc76.04% <75.00%> (-0.20%)⬇️

... and 65 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@StefanStojanovicStefanStojanovic added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2026
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2026
@PickBas

Copy link
Copy Markdown
ContributorAuthor

Closing this PR, as a similar PR has already been merged that also resolves #64322.

@PickBasPickBas closed this Jul 24, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 76

3 participants

@PickBas@StefanStojanovic@nodejs-github-bot