Skip to content
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

ternserver.js gets stuck at 100% cpu on one core #18

Open
hamoid opened this issue Nov 29, 2014 · 9 comments
Open

ternserver.js gets stuck at 100% cpu on one core #18

hamoid opened this issue Nov 29, 2014 · 9 comments

Comments

@hamoid
Copy link

hamoid commented Nov 29, 2014

I'm not sure if I should report this here or at tern.js. While using LightTable, sometimes I notice the fans are blowing full speed non stop. When looking at the task manager, I see that a node process that runs ternserver.js is using one of the CPU cores at 100%. If I close LightTable and start it again, I may and with several instances of this process, each using one core.

In the editor sometimes I notice that autocomplete acts weird. The suggestions close immediately without having time to choose one, or existing variables are not suggested. After 5 or 10 seconds it starts working again.

I posted a screenshot and a comment about it in the LT issues.

Is there anything I can do to help find why this is happening?

@mortalapeman
Copy link
Owner

The CPU issue I've seen before with tern it's self. It seems like some codebases will cause the analyzer to be caught in an infinite loop, but I haven't been able to relieabley replicate the problem.

I have also seen the glitchy UI issues and they are likely on Light Table's end, but I also have not been able to reliably reproduce the issue.

Thank you for filing this bug! However, I don't have much time to invest in tracking down issues in other projects. If you have some steps for consistently reproducing the problem, it would help me tremendously.

@hamoid
Copy link
Author

hamoid commented Dec 1, 2014

Thanks for your reply. To reproduce the error in my system:

  1. Open LT, create a new file, save it as blabla.js
  2. Type "cons"
  3. LT shows the autocomplete suggestions and I press enter to accept the first one.
    Now ternjs is stuck and I have to kill it.

As soon as I typed the first letter in the empty js file ("c") in point 2, below I read 'connected to tern server' and I see this error in the console several times:

TypeError: Cannot read property 'completion' of undefined
    at eval (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:31759:44)
    at b (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:6435:45)
    at eval (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:7913:33)
    at cljs.core.LazySeq.sval (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:5561:40)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:5571:8)
    at cljs.core._seq (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:2311:14)
    at cljs.core.seq (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:2824:27)
    at eval (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:7899:27)
    at cljs.core.LazySeq.sval (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:5561:40)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:5571:8)
    at cljs.core._seq (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:2311:14)
    at cljs.core.seq (file:///home/npro/Desktop/LightTable/core/node_modules/lighttable/bootstrap.js:2824:27)

Any clues? Thanks!

@mortalapeman
Copy link
Owner

Interesting. That is usually one of the first things I type out when testing the plugin. What Light Table version and OS are you running?

Also, post your tern specific behaviors you in your user and workspace if you've changed any of the defaults.

@hamoid
Copy link
Author

hamoid commented Dec 2, 2014

I've got LT 0.7.2, binary version 0.8.4. I'm on Ubuntu 14.04, Fish shell, using i3wm instead of Unity.
Workspace behaviors is empty. User behaviors:

[:app :lt.objs.style/set-skin "dark"]
[:app :lt.objs.settings/pair-keymap-diffs]

[:editor :lt.objs.editor/no-wrap]
[:editor :lt.objs.style/font-settings "" "13" ""]
[:editor :lt.objs.style/set-theme "base16-dark"]

[:editor.clojure :lt.objs.langs.clj/print-length 1000]

;; Try to disable menu in i3wm
[:app :-lt.objs.menu/create-menu]
[:app :-lt.objs.menu/set-menu]
[:window :-lt.objs.menu/set-menu]

;; Show git changes
[:modific [(:lt.plugins.modific.util/settings
           {:git {:dir ".git" :bin "git" :diff.options ["--no-color" "--no-ext-diff"]}
            :max.file.length 1000 ; lines
            :gutter-width 2})]]

@mortalapeman
Copy link
Owner

Excellent! I'll get to testing sometime this week. Thanks for the feedback,
I'll see if I can get this problem resolved.
On Dec 2, 2014 5:19 AM, "Abe Pazos" [email protected] wrote:

I've got LT 0.7.2, binary version 0.8.4.

I'm on Ubuntu 14.04, Fish shell, using i3wm instead of Unity.

Workspace behaviors is empty.

User behaviors:

'''
[:app :lt.objs.style/set-skin "dark"]
[:app :lt.objs.settings/pair-keymap-diffs]

[:editor :lt.objs.editor/no-wrap]
[:editor :lt.objs.style/font-settings "" "13" ""]
[:editor :lt.objs.style/set-theme "base16-dark"]

[:editor.clojure :lt.objs.langs.clj/print-length 1000]

;; Try to disable menu in i3wm
[:app :-lt.objs.menu/create-menu]
[:app :-lt.objs.menu/set-menu]
[:window :-lt.objs.menu/set-menu]

;; Show git changes
[:modific [(:lt.plugins.modific.util/settings
{:git {:dir ".git"
:bin "git"
:diff.options ["--no-color" "--no-ext-diff"]}
:max.file.length 1000 ; lines
:gutter-width 2})]]
'''


Reply to this email directly or view it on GitHub
#18 (comment)
.

@hamoid
Copy link
Author

hamoid commented Dec 3, 2014

I forgot: 32bit. I tried installing it again, but same behavior on fresh LT. The configuration folder is not fresh though...

@mortalapeman
Copy link
Owner

Sorry it's taken me a while to get back to you with feedback. Life has been pretty hectic lately.

The good news is that I can reproduce the console error you provided. I remember tracking down the source of that error, but I don't remember what the resolution was. In any case, it doesn't appear to interfere with the plugin's ability to provide JavaScript auto completion.

The bad news is, I have followed the steps you provided and could not reproduve the issue. I ran top to see if node starting eating up my CPU but everything appears to be functioning normally.

I use the same version of node to run the Tern process that Light Table uses and you don't appear to have changed any of the default behaviors regarding tern in your project. Maybe there is a workspace you have currently loaded that contains JS files which cause tern to go into an infinite loop. Try adding
{:+ {:tern.config [:lt.plugins.tern/lazy-loading]}} to your user behaviors file. That should keep the plugin from trying to eagerly load any JavaScript files in your work space.

@hamoid
Copy link
Author

hamoid commented Jan 1, 2015

Thank you for taking a look at it.

Is your suggested change to user behaviors using the new configuration
format? I ask because in my file I only see square brackets, not curly
braces, and I'm not so familiar with the syntax :)

Happy new year!

@mortalapeman
Copy link
Owner

Oh man, I probably need to update all my plugins and README files to use the new flat syntax. It looks like you would just add [:tern.config :lt.plugins.tern/lazy-loading] to the main vector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants