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

CPU 100% while application is running idle #8244

Closed
sebakerckhof opened this issue Jan 12, 2017 · 5 comments
Closed

CPU 100% while application is running idle #8244

sebakerckhof opened this issue Jan 12, 2017 · 5 comments

Comments

@sebakerckhof
Copy link
Contributor

Some people have reported 100% CPU usage in a meteor app, without the app actually having to do any work.

I ported my app from Meteor 1.2 to Meteor 1.4.2.3, and I'm now also experiencing this problem.
I have it both in development mode and in a production build (so just running the node bundle inside a docker container).

I've been able to take a CPU profile that I can share via kadira, I hope this can help to trace the problem:
https://ui.kadira.io/cpf/5rcLdo3apwSTJHn9s?metric=costlyFunction

This is from a production build, where the app is basically doing nothing (no clients connected)
Meteor version: 1.4.2.3
Node version: 4.6.1

Additionally, I see that in the production it's at 100% right from the start.
In development mode, it's at around 30% on my i7 machine, as soon as I load the app on 1 client it goes to 100% and stays there, even if I close the page.

@sebakerckhof
Copy link
Contributor Author

sebakerckhof commented Jan 12, 2017

Okay, I partially found the cause.

I have a dependency tree somewhat like:

app
 |-package 'foo'
    |-pbastowski:angular-babel@1.3.6
    |-package 'compilers'
       |-pbastowski:angular-babel@1.3.6 (implied)

Package compilers is an umbrella package with some compilers, because of that pbastowski:angular-babel@1.3.6 doesn't need to be explicitly set as a dependency in package foo.
If I remove this dependency in foo. The high CPU usage is gone.

i.e. this configuration resolves the high CPU usage.

app
 |-package 'foo'
    |-package 'compilers'
       |-pbastowski:angular-babel@1.3.6 (implied)

However, this should in theory give me the exact same result as the original configuration. So this is either a bug in Meteor, pbastowski:angular-babel or meteor-promise.

I'll see if I can make a reproduction

@ramezrafla
Copy link
Contributor

I had the same issue and it turned out to be Node version (I saw you on the forum commenting as well). Once we went back to v4.6.2 all worked. Also, Kadira output didn't make sense too.

@ramezrafla
Copy link
Contributor

Can we close? Thanks

@hwillson
Copy link
Contributor

Since it sounds like a solution/workaround has been found for the original issue, I'll close this off. If you're able to put together a repro showing this issue further, we can definitely re-open if needed. Thanks for posting this originally (and thanks again for the follow up @ramezrafla!).

@maxnowack
Copy link
Contributor

maxnowack commented Feb 20, 2018

I have a similar problem since a long time for now. I think since version 1.3 or so. I'm not sure when it's started exactly.
The meteor node process is always on 100%.

I've already tried to find the root of the problem, but without any luck.
Today I'm started to analyze the issue and found something interesting.
I've run errinfo to analyze errors in the node process and it seems, that the process tries to read a lot of files that are not existing (I've hitted Ctrl+C after 10 seconds):

$ sudo errinfo -c -p 75338
Tracing... Hit Ctrl-C to end.
^C
            EXEC          SYSCALL  ERR  COUNT  DESC
            node           stat64    2 253949  No such file or directory

I've went a little deeper and ran dtruss see the the errors. The output looks something like this:

…
psynch_mutexwait(0x1015A0850, 0x2DDA5903, 0x2DDA5700)		 = 769284611 0
psynch_mutexwait(0x1015A0850, 0x2DDA5A03, 0x2DDA5700)		 = 769284611 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_cvsignal(0x1015A0890, 0x6331E8006331EB00, 0x6331E800)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331E6006331E900, 0x6331E600)		 = 0 0
psynch_mutexdrop(0x1015A0850, 0x2DDA5B03, 0x2DDA5A00)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA5B03, 0x2DDA5900)		 = 769284867 0
psynch_mutexdrop(0x1015A0850, 0x2DDA5D03, 0x2DDA5B00)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA5C03, 0x2DDA5A00)		 = 769285379 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie.js\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_mutexwait(0x1015A0850, 0x2DDA5D03, 0x2DDA5A00)		 = 769285379 0
psynch_cvsignal(0x1015A0890, 0x6331E9006331EC00, 0x6331E900)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331E7006331EA00, 0x6331E700)		 = 0 0
psynch_mutexdrop(0x1015A0850, 0x2DDA5E03, 0x2DDA5D00)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA5E03, 0x2DDA5C00)		 = 769285635 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6003, 0x2DDA5E00)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA5F03, 0x2DDA5D00)		 = 769286147 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie.json\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_mutexwait(0x1015A0850, 0x2DDA6003, 0x2DDA5D00)		 = 769286147 0
psynch_cvsignal(0x1015A0890, 0x6331EA006331ED00, 0x6331EA00)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331E8006331EB00, 0x6331E800)		 = 0 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6103, 0x2DDA6000)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6103, 0x2DDA5F00)		 = 769286403 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6303, 0x2DDA6100)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6203, 0x2DDA6000)		 = 769286915 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie.html\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_mutexwait(0x1015A0850, 0x2DDA6303, 0x2DDA6000)		 = 769286915 0
psynch_cvsignal(0x1015A0890, 0x6331EB006331EE00, 0x6331EB00)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331E9006331EC00, 0x6331E900)		 = 0 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6403, 0x2DDA6300)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6403, 0x2DDA6200)		 = 769287171 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6603, 0x2DDA6400)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6503, 0x2DDA6300)		 = 769287683 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie.coffee\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_mutexwait(0x1015A0850, 0x2DDA6603, 0x2DDA6300)		 = 769287683 0
psynch_cvsignal(0x1015A0890, 0x6331EC006331EF00, 0x6331EC00)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331EA006331ED00, 0x6331EA00)		 = 0 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6703, 0x2DDA6600)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6703, 0x2DDA6500)		 = 769287939 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6903, 0x2DDA6700)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6803, 0x2DDA6600)		 = 769288451 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie.jsx\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_mutexwait(0x1015A0850, 0x2DDA6903, 0x2DDA6600)		 = 769288451 0
psynch_cvsignal(0x1015A0890, 0x6331ED006331F000, 0x6331ED00)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331EB006331EE00, 0x6331EB00)		 = 0 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6A03, 0x2DDA6900)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6A03, 0x2DDA6800)		 = 769288707 0
psynch_mutexdrop(0x1015A0850, 0x2DDA6B03, 0x2DDA6A00)		 = 0 0
psynch_mutexwait(0x1015A0850, 0x2DDA6B03, 0x2DDA6900)		 = 769289219 0
stat64("/Users/maxnowack/code/teamgrid/imports/system/node_modules/js-cookie.css\0", 0x70000AAE1E80, 0x0)		 = -1 Err#2
psynch_mutexwait(0x1015A0850, 0x2DDA6C03, 0x2DDA6A00)		 = 769289219 0
psynch_cvsignal(0x1015A0890, 0x6331EE006331F100, 0x6331EE00)		 = 256 0
psynch_cvwait(0x1015A0890, 0x6331EC006331EF00, 0x6331EC00)		 = 0 0
…

It seems, that the build tool is scanning every directory of my app (maybe just only the imports folder) for a node_modules folder and non existing files. Here is a gist with the full output (10 seconds): https://gist.github.com/maxnowack/60d6be8e0d42eaf53648d2715391d01f
@benjamn do you have an idea why this occurs?

Edit: I'm using Meteor 1.6.1 on OSX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants