Skip to content
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

"Exit handler never called" error when /proc is not accessible #6316

Closed
2 tasks done
codedokode opened this issue Mar 31, 2023 · 4 comments · Fixed by #6317
Closed
2 tasks done

"Exit handler never called" error when /proc is not accessible #6316

codedokode opened this issue Mar 31, 2023 · 4 comments · Fixed by #6317
Assignees
Labels
Priority 1 high priority issue Release 9.x work is associated with a specific npm 9 release

Comments

@codedokode
Copy link

codedokode commented Mar 31, 2023

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When /proc/stat and /proc/cpuinfo are not accessible and version 1 package-lock.json is present, npm ci fails to install packages with "exit handler never called" error after "The package-lock.json file was created with an old version of npm" warning. This is caused by a bug in promise-call-limit library.

To check whether the system is affected by the bug one can run this command:

node -e "console.log(require('os').cpus())"

If it prints an empty list [] then there is a bug and npm will fail either at idealTree:inflate stage or at build:run:* stage. This is caused by a bug in callLimit function that doesn't run any of the passed functions if CPU count cannot be determined. This function is invoked in two places: when parsing old lock file and when running build:run.

I have made a pull request to fix the bug: isaacs/promise-call-limit#11 . Please consider updating promise-call-limit version.

So, the bug only happens if /proc not being accessible and stage is idealTree:inflate (and old lockfile is present) or build:run:*.

Searching around shows that there are bugs from users trying to use npm in different OSes which might be caused by the same reason:

These users should run the command above to check whether their issue is caused by this bug.

Expected Behavior

npm ci runs successfully without errors

Steps To Reproduce

  1. Create a container without /proc mounted or unmount /proc or use OS without /proc
  2. Run node -e "console.log(require('os').cpus())" and see that it prints []
  3. Create a directory and create a package-lock.json with following contents:
{
  "name": "test-npm-bug",
  "requires": true,
  "lockfileVersion": 1,
  "dependencies": {
    "@nodelib/fs.stat": {
      "version": "2.0.5",
      "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
      "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="
    }
  }
}

Also create package.json:

{
  "name": "test-npm-bug",
  "dependencies": {
      "@nodelib/fs.stat": "2.0.5"
  }
}
  1. Run npm ci --ddd
  2. See messages in log:
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm verb unfinished npm timer command:ci 1680276840213
npm verb unfinished npm timer idealTree 1680276840284
npm verb unfinished npm timer idealTree:inflate 1680276840288
npm info ok 
npm ERR! Exit handler never called!

Environment

  • npm: 9.6.3
  • Node.js: v18.15.0
  • OS Name: Linux
  • System Model Name:
  • npm config:
; node bin location = /usr/bin/node
; node version = v18.15.0
; npm local prefix = /shared/test-npm
; npm version = 9.6.3
; cwd = /shared/test-npm
; HOME = (removed)
; Run `npm config ls -l` to show all defaults.
@codedokode codedokode added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Mar 31, 2023
@codedokode
Copy link
Author

Updating promise-call-limit to 1.0.2 fixed the bug for me like a magic.

@wraithgar wraithgar added Priority 1 high priority issue and removed Bug thing that needs fixing Needs Triage needs review for next steps labels Mar 31, 2023
@wraithgar
Copy link
Member

Please don't close this even after promise-call-limit is patched. The underlying issue still needs to be caught.

@wraithgar
Copy link
Member

Looks like npm itself couldn't have caught this. The promise with no resolve is totally in a subdependency, and there is no guard for that.

@duchenpaul
Copy link

duchenpaul commented May 29, 2023

Is this problem resolved, see it is open here: #4839.
And I have such a problem as well, npm version npm 9.6.6 in docker image node:20-alpine3.16

Maybe my problem is not related, I can access /proc:

/ # node -e "console.log(require('os').cpus())"
[
  {
    model: 'Intel(R) Pentium(R) CPU G4560T @ 2.90GHz',
    speed: 2904,
    times: { user: 1485450, nice: 50, sys: 698800, idle: 35546700, irq: 0 }
  },
  {
    model: 'Intel(R) Pentium(R) CPU G4560T @ 2.90GHz',
    speed: 2904,
    times: { user: 1464740, nice: 80, sys: 700970, idle: 35694010, irq: 0 }
  }
]

I see below errors, thought it was the same issue:

npm verb unfinished npm timer idealTree:inflate 1680276840288
npm info ok 
npm ERR! Exit handler never called!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 1 high priority issue Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants