Answer the question
In order to leave comments, you need to log in
What causes 100% CPU usage when using watch (fs.watch/gulp.watch/forever --watch/etc) in NodeJS?
I have VMWare with ubuntu installed. A folder with code is shared between Ubuntu and Windows and routing is configured to access the Ubuntu web server from the host. Thus, it turns out that the code is written under Windows, but runs in a Linux environment. Everything is fine, but there is a problem. When using watch on a shared (sub)directory, either immediately or after a certain time (from 1-60 seconds), ubunta abruptly loads the percentage by 100%. Saves only a hard reset of the virtual machine.
Empirically, it was found that the problem as a whole is with the watch mechanism, and not with any particular module.
VMWare 10.0.0 build-1295980
Ubuntu 12.04 (3.8.0-44-generic x86_64)
Windows 7 x64
In the VM settings, I shared the Windows folder D: / ubuntu, then mounted its subdirectory in Ubuntu in /etc/fstab:.host:/ubuntu/var/app /var/app vmhgfs defaults 0 0
After that, when using something like gulp.watch('/var/app/public/js/**/*.js', ...) in Ubuntu, the above trouble with CPU loading appears. Any ideas how to get rid of this?
Do not offer the option with "why do you need a bike with a virtual machine, use a Windows nodejs" :) In addition to the node, a lot of other things are used, so the required environment cannot be created in Windows.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question