Bug: qnm spawns check.js which eats CPU
SleepWalker opened this issue · 3 comments
Hello everyone,
I've updated from 1.6 to 2.4. And now, when I issue any command (even qnm -v
), qnm spawns multiple check.js
processes that are hanging around and eating lots of CPU. The only way I've managed to kill it is by using pkill node
.
Here is the script that is spammed: https://github.com/datacrafts-io/update-notifier-webpack/blob/master/check.js
But looks like the issue is not with that script but with current startup logic and ncc
. There are actually two issues
Issue 1
ncc
produces two files index.js
and check.js
. When index.js
is required, it immediately calls updateNotifier({ pkg }).notify();
which behind the scenes spawns check.js:
and here is how check.js
is looks like:
Looks like updateNotifier({ pkg }).notify();
should be called at the later stage. Somewhere after parsing the args.
Issue 2
updateNotifier({ pkg }).notify();
is not the only thing, that runs on require('.')
from check.js
. There is also command line parsing that is running too.
If you change stdio in spawn
call from ignore, to inherit:
you'll see the following error:
this is qnm cli trying to find module when check.js
runs
@SleepWalker thanks for opening this issue, I decided to remove this mechanism at the moment and to tackle it again whenever there is time.
For now the fix exist on v2.5.0
I wanted to mention that I appreciate the detailed explanation! ❤️
Wow. Thank you for the super fast fix 🔥