Skip to content

[BUG] npm cache verify EMFILE #4783

@straub

Description

@straub

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

Currently observing EMFILE errors when running npm cache verify using npm >=8.6.0 on our Jenkins agents (EC2 instances), despite increasing ulimit -n from 1024 to 8192. Cannot reproduce in the same exact instance when using npm 8.5.5.

Please let me know what detail might be useful to help debug this! I've collected strace output and silly-level logging. If any of that is useful, I can attempt to sanitize it to share!

In the meantime, I'll likely move forward with removing the npm cache verify step from our Jenkins pipelines, and see if the other commands can succeed, although that will leave me with fewer warm fuzzies.

[jenkins@ip-*** ~]$ npm --version
8.7.0
[jenkins@ip-*** ~]$ npm cache verify
npm ERR! code EMFILE
npm ERR! syscall open
npm ERR! path /home/jenkins/.npm/_cacache/index-v5/fd/c4/a0078e5394b7a947414bc4d71219bd2dd87b8ace9e565a9f22f52432a4ad
npm ERR! errno -24
npm ERR! EMFILE: too many open files, open '/home/jenkins/.npm/_cacache/index-v5/fd/c4/a0078e5394b7a947414bc4d71219bd2dd87b8ace9e565a9f22f52432a4ad'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jenkins/.npm/_logs/2022-04-20T19_25_34_307Z-debug-0.log
[jenkins@ip-*** ~]$ npm --version
8.6.0
[jenkins@ip-*** ~]$ npm cache verify
npm ERR! code EMFILE
npm ERR! syscall open
npm ERR! path /home/jenkins/.npm/_cacache/index-v5/fd/c4/a0078e5394b7a947414bc4d71219bd2dd87b8ace9e565a9f22f52432a4ad
npm ERR! errno -24
npm ERR! EMFILE: too many open files, open '/home/jenkins/.npm/_cacache/index-v5/fd/c4/a0078e5394b7a947414bc4d71219bd2dd87b8ace9e565a9f22f52432a4ad'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jenkins/.npm/_logs/2022-04-20T19_32_54_323Z-debug-0.log

Expected Behavior

[jenkins@ip-*** ~]$ npm --version
8.5.5
[jenkins@ip-*** ~]$ npm cache verify
Cache verified and compressed (~/.npm/_cacache)
Content verified: 7137 (742847642 bytes)
Index entries: 7643
Finished in 24.011s

Steps To Reproduce

  1. On our Jenkins build agents (see environment below)
  2. With a particular .npm cache (I can try to make this available, upon request)
  3. When using npm versions >= 8.6.0
  4. Run npm cache verify
  5. Observe EMFILE error

Environment

  • npm: 8.6.0 and 8.7.0
  • Node.js: 14.19.1
  • OS Name: Amazon Linux 2
  • System Model Name:
  • npm config:
$ npm config ls
; "user" config from /home/jenkins/.npmrc

; [private registries redacted]

; node bin location = /home/jenkins/.nvm/versions/node/v14.19.1/bin/node
; cwd = /home/jenkins
; HOME = /home/jenkins
; Run `npm config ls -l` to show all defaults.
$ cat /etc/*-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Amazon Linux release 2 (Karoo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions