halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
192 stars 24 forks source link

Upgraded from 8.6.4 -> 9.0.1 Elmjutsu hangs Atom completely #135

Closed anagrius closed 5 years ago

anagrius commented 5 years ago

I have two colleagues that complained that they could not get elm working in Atom. Both machines hung after a few seconds when Elmjutsu was installed and opening Atom.

I tried to upgrade from 8.6.4 -> 9.0.1 and the same happened to me. I will try to get some profiling out, but it is hard since it hangs that too.

Out project is ~80klogs of Elm so it might be a problem on larger projects only. The project is Elm 0.18, if that makes a difference.

In the console it spams:

Uncaught Error: Error watching file for changes: EMFILE
    at _errnoException (util.js:1024:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1363:9)

many thousands times.

Downgrading also no longer works. Atom will still lock up if 8.6.4 is reinstalled.

EDIT:

Ok, the profile file got too big 150MB so, not going to post it here. It is indeed the fs.js module spending all the time on error processing.

See image.

screenshot 2018-10-16 at 11 20 25
halohalospecial commented 5 years ago

Hi @anagrius, have you tried it with smaller Elm 0.18/0.19 projects?

anagrius commented 5 years ago

@halohalospecial It does not happen on smaller projects. Just checked. We don't get any:

Uncaught Error: Error watching file for changes: EMFILE
    at _errnoException (util.js:1024:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1363:9)

I am trying to figure out how to see in the exceptions exactly which file/files it is trying to watch and fails

anagrius commented 5 years ago

@halohalospecial What exactly are you watching file changes for? I see it looks like e.g. all files in node_modules are also observed.

halohalospecial commented 5 years ago

@anagrius, you can check it here:

https://github.com/halohalospecial/atom-elmjutsu/blob/d646d2943acd7828dae6680b7231beee99707107/lib/core.js#L387-L393

halohalospecial commented 5 years ago

Can you also check with just Elmjutsu installed? Maybe another Atom package is also watching files?

anagrius commented 5 years ago

Sure, I will. But the hanging only occurs with Elmjutsu installed

halohalospecial commented 5 years ago

How about adding 'node_modules/**' to ignored?

https://github.com/halohalospecial/atom-elmjutsu/blob/d646d2943acd7828dae6680b7231beee99707107/lib/core.js#L400

anagrius commented 5 years ago

Well, if you don't need to know about Elm files in there, then I would say go for it. I mean there is no need having chokidar run through all those files for nothing.

anagrius commented 5 years ago

I just wiped node_modules and everything is working until I do npm install, then it hangs again. So that seems to be it.

halohalospecial commented 5 years ago

Can you can modify your ~/.atom/packages/elmjutsu/lib/core.js to test? :grin:

anagrius commented 5 years ago

Yeah, I did right after actually. No change :( But keeping node_modules empty does the trick. (Not a very long term solution though.

halohalospecial commented 5 years ago

Have you tried adding node_modules or node_modules/**/* to ignored? Apparently, it's still traversing the node_modules directory with node_modules/**.

anagrius commented 5 years ago

node_modules/*/ seems to do the trick!