GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [v24.x backport] fs: do not swallow exceptions thrown by completion callbacks by marcopiraccini · Pull Request #67703 · nodejs/node

Conversation

@marcopiraccini

@marcopiraccini marcopiraccini commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Backport of #66308 to v24.x.

Since #57706 (in v24.x since 6d39c47) the completion callbacks of fs.mkdtemp, fs.realpath.native, fs.readlink, fs.mkdir({ recursive }) and dir.read() call into JS while the TryCatch meant for StringBytes::Encode is still in scope, so an exception thrown by the user callback, or by the nextTick queue drained right after it, is swallowed. Under node:test this ends in Assertion failed: (env_->execution_async_id()) == (0) and SIGABRT, see #65667 and #66308 (comment), which reproduces it on v24.22.3.

The cherry-pick conflicted only because the original commit also touched code that is not in v24.x: the mkstemp helpers in src/node_file-inl.h and the native recursive readdir in src/node_file.cc. Those hunks were dropped; the rest of the change applied cleanly. test/parallel/test-fs-callback-throw.js is unchanged, its readdir recursive case runs through the JS implementation on v24.x.

Refs: #66308
Fixes: #65667

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@marcopiraccini
fs: do not swallow exceptions thrown by completion callbacks
d29ea13
Since 93644d5 the TryCatch guarding StringBytes::Encode in the
completion callbacks of mkdtemp, realpath.native, readlink, recursive
mkdir, recursive readdir and dir.read is still active when the JS
callback runs. Exceptions thrown by the callback, or by the nextTick
queue drained after it, are caught by it and never reported.

Leave the TryCatch before calling into JS.

Fixes: nodejs#65667
Refs: nodejs#57706
Signed-off-by: marcopiraccini <[email protected]>
PR-URL: nodejs#66308
Reviewed-By: Paolo Insogna <[email protected]>
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch. labels Nov 22, 2026
@marcopiraccini marcopiraccini mentioned this pull request Nov 22, 2026
fs: do not swallow exceptions thrown by completion callbacks #66308
Merged
@ShogunPanda ShogunPanda added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 22, 2026
ShogunPanda
ShogunPanda approved these changes Nov 22, 2026
View reviewed changes
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 22, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79409/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.43%. Comparing base (9e39360) to head (d29ea13).
⚠️ Report is 964 commits behind head on v24.x-staging.

Files with missing lines Patch % Lines
src/node_file-inl.h 80.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           v24.x-staging   #67703      +/-   ##
=================================================
+ Coverage          90.31%   90.43%   +0.12%     
=================================================
  Files                711      717       +6     
  Lines             228425   241930   +13505     
  Branches           43160    46205    +3045     
=================================================
+ Hits              206293   218795   +12502     
- Misses             14090    14564     +474     
- Partials            8042     8571     +529     
Files with missing lines Coverage Δ
src/node_dir.cc 70.41% <100.00%> (-0.03%) ⬇️
src/node_file.cc 74.65% <100.00%> (-1.34%) ⬇️
src/node_file-inl.h 85.17% <80.00%> (-2.55%) ⬇️

... and 299 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcopiraccini

marcopiraccini commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

The macOS failure is test-tls-resume-servername, a known flake fixed on main by #67450, which is not in v24.x-staging yet. Unrelated to this change. Could someone re-run the CI?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@inoway46 inoway46 added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 23, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 23, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79448/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@ShogunPanda ShogunPanda ShogunPanda approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@marcopiraccini @nodejs-github-bot @ShogunPanda @inoway46
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.