-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Notifier with --watch uses 100% CPU on Mac and notifier processes never terminate #8830
Labels
Comments
jackkinsella
changed the title
Jest --watch --notifier uses 100% CPU on Mac
Jest --watch --notify uses 100% CPU on Mac
Aug 15, 2019
PR very much welcome adding a timeout 🙂 |
jackkinsella
changed the title
Jest --watch --notify uses 100% CPU on Mac
jest --watch --notify uses 100% CPU on Mac
Aug 15, 2019
jackkinsella
changed the title
jest --watch --notify uses 100% CPU on Mac
Notifier with with uses 100% CPU on Mac and notifier processes never terminate
Aug 15, 2019
jackkinsella
changed the title
Notifier with with uses 100% CPU on Mac and notifier processes never terminate
Notifier with --watch uses 100% CPU on Mac and notifier processes never terminate
Aug 15, 2019
jackkinsella
added a commit
to jackkinsella/jest
that referenced
this issue
Aug 15, 2019
Fixed and released |
This was referenced Dec 31, 2019
This was referenced Jan 7, 2020
This was referenced Jan 21, 2020
This was referenced Mar 21, 2020
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
🐛 Bug Report
I noticed that when running the jest unit testing library with
--watch --notify
(which callsnode-notifier
), my CPU usage soon went up to 90%, due to multiple instances ofnode-notifier
hanging around. There are a couple of other people with the same issue over on in the jest repo.Here's an example process that was spinning:
./myapp/node_modules/node-notifier/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier -actions Run again,Exit tests -closeLabel "Close" -message "-&M-T️ 1 of 29 tests failed" -title "4% Failed" -ap
Here's is a log of a single iteration of the repeated system calls — it seems to be unable to unlock a semaphore: system-calls.log
I experimented around with the
node-notifier
library's API and noticed that if I passed the same configuration options tonode-notifier
asjest
does, the program never ends. To see what I mean, run the following in a stand-alone program. You'll notice it displays the notification but the program keeps running indefinitely.However, when I removed the
actions
attribute, the program ends after the notification is shown. I could also get the program to end, even with actions, by adding an explicittimeout
attribute:I brought up this issue with the maintainer of
node-notifier
and both of us think it would be best if thejest
team considered adding a timeout here https://github.com/facebook/jest/blob/master/packages/jest-reporters/src/notify_reporter.ts#L108-L122To Reproduce
MacOS 10.14.3
Node 10.14.1
[email protected]
[email protected]
Make sure one test fails then run:
$ jest --watch --notifier
Next run
top -o cpu
— you should see a terminal-notifier process that never ends.Expected behavior
The number of terminal-notifier processes should not increase towards infinity with each notification, and CPU usage should be negligible.
The text was updated successfully, but these errors were encountered: