-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] Big performance issues and possible memory leak #3208
Comments
It is not replicated on: Mint 20.1 5.4.0-66-generic |
A more detailed error log:
|
Still reproduces on following specs (docker downgraded):
|
Still reproduces on following specs (docker and kernel downgraded):
Close match to @undoo host specs. |
Can confirm this issue on I do not get the heap limit allocation error, but it does hang on |
Apparently the out of heap doesn't reproduce anymore. Docker version 20.10.7, build f0df350 |
Happened again on previously mentioned newer version, but the Ubuntu 16 docker image.
|
Action: try to replicate |
@darcyclarke I am also experiencing a very slow
Edit: I have recorded new timings with the From the times it is clearly visible that an Using the alpine docker image does lead to the same results and using the |
@sonallux good summary. For us this is a dealbreaker. As news were promising us better performance with npm7, we wanted to update immediately, but we have pipelines, most projects have pipelines, and it is there where performance matters the most. |
#2011 is related (performance is even worse again is running inside a mounted volume in a container). |
@darcyclarke any news on this issue? Unfortunately, I am still experiencing the performance issue :/ I have recorded new timings with the latest npm version in this repo https://github.com/sonallux/npm7-performance-issue in this GitHub Actions run. The timings are all recorded with the
From the times it is clearly visible that an And this is not a GitHub actions specific problem, I can also reproduce this behaviour on Windows using Docker Desktop with WSL2 and on my Ubuntu 20.04 server. |
I got the same issue in node 16.13 with npm 8.1 running docker in jenkins. The job is killed because of memory issues. Which means that it could be a memory leak. |
I just want to add that I'm experiencing this issue as well on Node 16. This happened on Ubuntu 20.04 and CentOS 7 using different versions of k8s and Jenkins inbound agents. The only solution I found to alleviate the problem was to downgrade to npm v6. However |
I am encountering this problem as well, I was able to workaround it by creating an empty |
This is extremely weird, but I can confirm that this: mkdir node_modules
npm ci Is twice as fast (npm@7) or three times as fast (npm@8) as just: npm ci Hopefully this factoid will help someone at npm diagnose the root cause finally. |
I am getting same issue on same configuration. |
Hi (@darcyclarke ?), Is there anything we can do to help solve this? A setup with
is still bugged by this (slow, high memory consumption compared to the same setup with npm 6.*). |
I resolved this issue by going with non privileged user. Try using non root user in your docker file. |
Do try the thing mentioned above (create |
Speed improves, in my case, by 50% (18s to 12s) but the memory usage is still 4x larger compared to v6 don't know if this is the best way of checking max memory used, but if someone finds it useful: This bug is hunting us from + year ago 😢 |
@n3dst4 I have lost so much time trying different things on GitHub Actions (+ docker) to fix it after upgrading from npm@6 to npm@7 (this is where this issue has been introduced and it still persist on npm@8) using different docker containers, digging in to dependencies which may cause the issue, trying to add pre-dependencies which may be required for dependencies to be built and more.. hours of debugging.. and it was as simple as adding |
Signed-off-by: Jakub Mucha <[email protected]>
For us the main issue is the memory usage. Can't even test the speed of |
edit: my issue turned out to be #4896 -- which is a dep using the no-longer-supported git:// -- and there is a fix for that here. after doing that it is back to normal. original post:this issue sounds the same, but i'm not certain because i'm seeing it with npm@6. once i updated to using node v14 instead of node v12, npm ci consistent takes 5-10x longer.this image shows gh action history for one small project. before i changed the version, the action ran ~1m. after, consistently 7m+: in that image, the last 1m run was [email protected] and [email protected]. in my case, the issue can also be replicated on my local/mac, but trying [email protected] and [email protected] on my local still has the issue (3.8m for same project). note sure if that's new though, because i wasn't running ci locally before. maybe a package-lock problem? node v14 via nvm uses [email protected] i've been searching for weeks thinking it was a github private packages or npm.com service issue, but found this today. i've found even |
Repro package.json & package-lock.json: npm-oom-test.zip
Verbose Output
Edit: running with |
Moving to yarn. I don't need a 6gb memory docker to just install some deps. How can this still be an issue? 😢 |
apparently, running mkdir node_modules before npm ci speeds up dependencies installation. REF: npm/cli#3208 (comment)
related: npm/cli#2011 related: npm/cli#3208
related: npm/cli#2011 related: npm/cli#3208
Or try |
Current Behavior:
Running npm 7 in docker image has some serious performance issues. Running same npm 7 locally doesn't have this on the other hand. I was thinking about posting this in the docker repository, but I am still unsure of the culprit and how it is related to the problem. I have found that
reify:createSparse
is the task that slows down dramatically, which as I saw is creating directories. So I suspect this issue might be related to docker volumes. On the other hand using npm@6 there is no such issue in docker.Now when running same stuff on node:12-buster we also get the following out of heap error:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
. This doesn't happen on node 14 and 16. (* actually just happend so I might be wrong here)Originally I have found this issue using an ubuntu 16 docker image, but these other images also fail in the same manner.
Expected Behavior:
No performance issues in docker (vs local). No out of heap errors.
Steps To Reproduce:
Test package.json
Example 1.
npm i
to create the package lock in the directory where you created the above package.json.rm node_modules/ -rf
docker run --rm -it -v $PWD:/app -w /app node:16-buster npm i --legacy-peer-deps --verbose
in the directory where you created the above package.jsonreify:createSparse
Example 2:
npm i
to create the package lock in the directory where you created the above package.json.rm node_modules/ -rf
docker run --rm -it -v $PWD:/app -w /app node:12-buster bash -c "npm i -g npm@7 && npm i --legacy-peer-deps --verbose"
Environment:
The text was updated successfully, but these errors were encountered: