Skip to content

repl: fix eval errors thrown after close throwing ERR_USE_AFTER_CLOSE #58791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

dario-piotrowicz
Copy link
Member

Fixes #58784

prevent incorrect throws of ERR_USE_AFTER_CLOSE errors when the eval function of a repl server returns an error after the repl server has been closed

prevent incorrect throws of `ERR_USE_AFTER_CLOSE` errors when the eval
function of a repl server returns an error after the repl server
has been closed
@dario-piotrowicz dario-piotrowicz requested a review from lpinca June 22, 2025 12:41
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. labels Jun 22, 2025
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.09%. Comparing base (d7becc5) to head (6851671).
Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58791      +/-   ##
==========================================
- Coverage   90.10%   90.09%   -0.01%     
==========================================
  Files         640      640              
  Lines      188287   188291       +4     
  Branches    36916    36926      +10     
==========================================
- Hits       169651   169636      -15     
- Misses      11355    11385      +30     
+ Partials     7281     7270      -11     
Files with missing lines Coverage Δ
lib/repl.js 94.88% <100.00%> (+0.01%) ⬆️

... and 28 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.

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGMT

@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 22, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 22, 2025
@nodejs-github-bot
Copy link
Collaborator

@hildjj
Copy link

hildjj commented Jun 22, 2025

I have confirmed that this patch fixes my issue.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@dario-piotrowicz dario-piotrowicz added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 28, 2025
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jun 28, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
node:internal/modules/esm/resolve:275
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/hostedtoolcache/node/22.16.0/x64/lib/node_modules/@node-core/utils/node_modules/css-what/dist/esm/index.js' imported from /opt/hostedtoolcache/node/22.16.0/x64/lib/node_modules/@node-core/utils/node_modules/cheerio-select/lib/esm/index.js
at finalizeResolution (node:internal/modules/esm/resolve:275:11)
at moduleResolve (node:internal/modules/esm/resolve:860:10)
at defaultResolve (node:internal/modules/esm/resolve:984:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:780:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:704:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:687:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:305:38)
at ModuleJob._link (node:internal/modules/esm/module_job:137:49) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///opt/hostedtoolcache/node/22.16.0/x64/lib/node_modules/@node-core/utils/node_modules/css-what/dist/esm/index.js'
}

Node.js v22.16.0

https://github.com/nodejs/node/actions/runs/15943283499

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jun 28, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 28, 2025
@nodejs-github-bot nodejs-github-bot merged commit 9fe3316 into nodejs:main Jun 28, 2025
81 of 82 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 9fe3316

@dario-piotrowicz dario-piotrowicz deleted the dario/58784/repl-error-after-close-fix branch June 28, 2025 22:36
targos pushed a commit that referenced this pull request Jul 3, 2025
prevent incorrect throws of `ERR_USE_AFTER_CLOSE` errors when the eval
function of a repl server returns an error after the repl server
has been closed

PR-URL: #58791
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
aduh95 pushed a commit that referenced this pull request Jul 21, 2025
prevent incorrect throws of `ERR_USE_AFTER_CLOSE` errors when the eval
function of a repl server returns an error after the repl server
has been closed

PR-URL: #58791
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR_USE_AFTER_CLOSE in repl with async eval
6 participants