You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GetPackageJson internal binding should cache missing file results #56821
Linux codespaces-e55842 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
node/src/node_modules.cc
What steps will reproduce the bug?
Loading multiple files in the same folder (that doesn't contain a package.json) will trigger NodeJS to attempt to read package.json in that folder once for each file, rather than caching that the file did not exist and skipping the syscall.
How often does it reproduce? Is there a required condition?
100% reproduction.
What is the expected behavior? Why is that the expected behavior?
if (ReadFileSync(&package_config.raw_json, path.data()) < 0) {
returnnullptr;
}
should cache the "missing file" response in the package json result cache, so that future checks for that package.json will return a "missing file" result early and skip the syscall.
What do you see instead?
For each and every file load within a given directory that does not contain a package.json, NodeJS is making a separate open syscall against the package.json path for that folder.
Additional information
This is a performance regression from Node 18, which cached "missing file" results in its package.json cache.
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.
Activity
juanarbol commentedon Jan 30, 2025
Hi! Thanks for the report. PRs are more than welcome.
github-actions commentedon Jul 29, 2025
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
github-actions commentedon Aug 29, 2025
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.
For more information on how the project manages feature requests, please consult the feature request management document.