atom-ternjs
atom-ternjs copied to clipboard
Atom editor freezes up or becomes unresponsive
For the last little while I have been struggling to use atom-tern. On some of my projects every now and then tern will cause the editor to freeze for up to 20s or sometimes it doesn't ever come back and I have to close the unresponsive editor.
I don't see any serious errors that may be related to this and am struggling to figure out what is going on. If someone could let me know how to look for more information I could post that here as well. For now I have nothing much to go on.
I tried to capture a profile of an instance when these lockups occur. This is what I got:
Here is the raw profile file to explore (you only need to look at the last 20s of the profile):
I'm having this issue as well and it's preventing me from using the plugin
@tststs any idea how we could figure out what is going on here?
There are several problems.
Performance significantly drops by how much files are analysed and passed to loadEagerly, if there are minified files loaded by tern a.s.o. Some people just pass the whole project + node_modules. I saw this quite a few times.
I'm currently working on some large projects and do not face any performance issues. But it seems most people facing the performance issue.
I think the best solution would be reverting this commit (c7452ed). I really like the idea of the tern-wrapper but it seems, that the performance loose by not using the node process is way too high.
I too am having issues where this plugin locks up my editor mid typing lately. From my brief look at the developer tools trying to find the culprit, it looked like it was spending most of it's time on this section of code:
https://github.com/tststs/atom-ternjs/blob/2d61fe58ddd56e41f9895c682c05f8e6ad0a608e/lib/atom-ternjs-type.coffee#L128-L139
I'm not using loadEagerly
at all.
I'm having this issue even with very small projects. I'm only passing my index.js
file to loadEagerly so I don't think that that is the issue.
Could you both turn of inline suggestions and maybe tern-lint and give it a try? I will have a closer look at the timeline and type method today or tomorrow and see if i can spot the problem elsewhere.
Thanks for the suggestion. Tern-lint has already been switched off for me. I will try with inline suggestions off today and report back.
I tried fiddling with tern-lint earlier, didn't seem to make a difference. Where would one turn off inline-suggestions? I don't see such a setting in the plugin setting.
I think it's this setting Display inline suggestions for function params
.
Its display inline suggestion for function params.
Turned off both settings, restarted Atom, doesn't seem to have helped.
ok, i was expecting this. i'll try to push the tern server to a web worker for the next release.
Just a first try. Still pretty dirty and there are still quite a few things to do. But looking good so far. I'll keep you updated and hopefully get this done by the weekend.
Ok, 0.13.0 should be available now. If you find any issues please feel free to report.
There are still some performance issues i spotted, but i hope this release will fix some of them.
The webworker was only tested on darwin. If there are any issues on linux or windows, report and i will try to fix them as soon as possible.
Greetings.
Umm, now it's not working at all for me on OS X.
node.js:15 Uncaught TypeError: Cannot read property 'knownModules' of undefined (8) atom-ternjs-server-worker.js:34 Uncaught TypeError: Cannot read property 'request' of undefined
Closed and restarted all instances of atom? If this does not help, please open an issue with additional info: .tern-project a.s.o.
Greetings.
Yeah, even tried uninstalling, relaunching, installing, relaunching again, and still same issue. Restarting server also doesn't help. I will make a new issue.
Well, it doesn't lock up the editor anymore which is nice, but it is acting funky. It appears that it slowly starts taking longer and longer to respond with suggestions. It also appears that as you are typing you might choose older completion hints, resulting in repeated characters if you select one of them. These issues appear more with larger and more-complex files. Restarting the tern server seems to help a bit when it builds up.
I can think of a problem that might occur in large files, but haven't tested it yet.
If the previous request isn't resolved yet, atom-ternjs
still sends the next request on every action a.s.o.
Haven't thought about that yet.
About how much LOC has the file, that produces the issue? I will test it tomorrow and try to find a way to solve this.
I'm using a file with ~550 lines of JavaScript, which seems to consistently have the issue.
This is still an issue I think.
Tern constantly eats up 100% of CPU for even projects with only one index.js
and no node_modules
My project is a mere package.json, package-lock.json and index.js (I removed the node_modules folder, I actually have uuid as dependency)
When I restart tern, Another worker is launched, while the previous one still runs. Killing atom doesn't solve this as ternjs seems to start own worker processes and detaches them (who thought this would be a good idea?)
I'm using [email protected]
but tried 0.18.2, 0.18.1 and 0.18.0 as well.
Needless to say, this is a pretty huge show stopper for me. Guess I'll try some dev builds from ternjs.
@ptusch it is probably another issue though. I observe that each time I open Atom, I have in instance of atom-ternjs-server-worker.js
that is using ~100% of one CPU and this process doesn't go away when I close Atom.