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

Linking dependencies ignores "nice" command and goes up to 100% CPU #6875

Open
binarykitchen opened this issue Jan 5, 2019 · 4 comments
Open
Assignees
Labels

Comments

@binarykitchen
Copy link
Contributor

Do you want to request a feature or report a bug?
BUG

What is the current behavior?

nice -1 yarn --production still uses 100% of CPU. This when linking dependencies. My server is blocked for many minutes, even Postfix and all other mail traffic is down during that. Really bad. It should lower the priority based on nice -1 but nah, not happening.

Here an output, see my comment at end of line:

Your branch is up to date with 'origin/master'.
$ nice -1 yarn --production; gulp
[1/6] Validating package.json...
[2/6] Resolving packages...
[3/6] Fetching packages...
info @ffmpeg-installer/darwin-x64@4.1.0: The platform "linux" is incompatible with this module.
info "@ffmpeg-installer/darwin-x64@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffmpeg-installer/linux-ia32@4.1.0: The CPU architecture "x64" is incompatible with this module.
info "@ffmpeg-installer/linux-ia32@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffmpeg-installer/win32-ia32@4.1.0: The platform "linux" is incompatible with this module.
info "@ffmpeg-installer/win32-ia32@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffmpeg-installer/win32-ia32@4.1.0: The CPU architecture "x64" is incompatible with this module.
info @ffmpeg-installer/win32-x64@4.1.0: The platform "linux" is incompatible with this module.
info "@ffmpeg-installer/win32-x64@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffprobe-installer/darwin-x64@4.0.3: The platform "linux" is incompatible with this module.
info "@ffprobe-installer/darwin-x64@4.0.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffprobe-installer/linux-ia32@4.0.3: The CPU architecture "x64" is incompatible with this module.
info "@ffprobe-installer/linux-ia32@4.0.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffprobe-installer/win32-ia32@4.0.2: The platform "linux" is incompatible with this module.
info "@ffprobe-installer/win32-ia32@4.0.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @ffprobe-installer/win32-ia32@4.0.2: The CPU architecture "x64" is incompatible with this module.
info @ffprobe-installer/win32-x64@4.0.2: The platform "linux" is incompatible with this module.
info "@ffprobe-installer/win32-x64@4.0.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/6] Linking dependencies... <------------ here CPU is at 100% for many minutes !!!
...

What is the expected behavior?
During yarn install for production, server should still have some CPU left, able to run all other background processes and isn't blocking email traffic.

Please mention your node.js, yarn and operating system version.

└─❱❱❱ yarn --version
1.12.3
└─❱❱❱ node --version
v8.12.0

Server runs on Ubuntu 18.10

@ghost ghost assigned rally25rs Jan 5, 2019
@ghost ghost added the triaged label Jan 5, 2019
@Daniel15
Copy link
Member

Daniel15 commented Jan 5, 2019

It should lower the priority based on nice -1

Negative numbers actually increase the priority 😛 Try using a positive number and see if that helps.

Also, AFAIK nice only affects the kernel's CPU scheduler. The kernel decides to give less CPU time to a process that has a higher niceness value. The actually app doesn't change its behaviour as a result of its niceness value changing.

@binarykitchen
Copy link
Contributor Author

Oh lol ... I better study the nice command over again. Any recommendations what number to pick? Or do you know a better trick or command?

@Daniel15
Copy link
Member

Daniel15 commented Jan 5, 2019

Check the Wikipedia page (https://en.wikipedia.org/wiki/Nice_(Unix)) as well as the manpage (https://linux.die.net/man/1/nice or run man nice on your system).

Any recommendations what number to pick?

19 is the lowest priority... Basically everything else on the system takes priority over it, and it only gets CPU power / IO if nothing else needs it. Good for background jobs like backups (my nightly automated backups use nice 19). Apart from that I don't really have much advice around it - Maybe someone else has better advice 😄

@binarykitchen
Copy link
Contributor Author

15 works a bit better, doesn't block my server that much anymore. But I guess that during linking other processes are being called, i.E. ffmpeg compilation (see my output above). Wondering if the nice command is passing on the nicety to the child processes it's spawning?

On a side note, I also wonder if yarn itself should have some code or countermeasures to prevent this from happening? This on any server.

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

No branches or pull requests

3 participants