nim-lang / NimLime

The official Nim programming language plugin for Sublime Text
MIT License
132 stars 34 forks source link

"error: plugin_host has exited unexpectedly" #99

Closed timotheecour closed 5 years ago

timotheecour commented 6 years ago

I'm getting a lot of these "error: plugin_host has exited unexpectedly" when editing nim files ; probably nimsuggest failing and the plugin not properly handling errors

full error: "error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted"

Varriount commented 6 years ago

I've been trying to diagnose this - unfortunately it seems to have appeared with one of the more recent builds of Sublime Text.

timotheecour commented 6 years ago

/cc @Varriount do you have a reproducible test? it's been occurring frequently recently ; didn't use to be the case, say 1 month ago IIRC (but i could be wrong) ; could be that the plugin crashes; could we perhaps wrap the entire plugin callback in a try/catch and log to some file when error occurs for debugging (eg: /tmp/NimLine.crash.log or better, configure that in sublime json config)

also, just curious, was that message sent by accident and then deleted on gitbhub? Doesn't os.nim export ospaths? in https://github.com/nim-lang/Nim/pull/8213

timotheecour commented 6 years ago

/cc @Varriount looks like I found a reproducible test case. It always crashes with "error: plugin_host has exited unexpectedly" when I open this file and press command+S to save it.

Please let me know whether you can reproduce it on your end.

#[
# plugin_host bug: https://github.com/Varriount/NimLime/issues/99
open this in sublime text
when use saves this file (eg on OSX: via command + S), the plugin_host will die
seems like a minimal-ish test case: variations of this file won't trigger that bug (eg removing =0, commenting a line, removing {.strdefine.} etc)
]#

const testCase {.strdefine.}: string=0
when false: discard
elif testCase == "test1":

/cc @Varriount EDIT looks like the root cause is that nimsuggest crashes with SIGSEGV on this example; I just filed https://github.com/nim-lang/nimsuggest/issues/83

that's progress!

timotheecour commented 6 years ago

WORKAROUND: set this as follows: Packages/User/NimLime.sublime-settings

{
    "nim.executable": "",
}

obviously not a good workaround since it'd disable a lot of features of NimLine, but at least syntax highlighting for nim would still work

alehander92 commented 6 years ago

@timotheecour thank you, a lifesaver

timotheecour commented 5 years ago

closing since https://github.com/nim-lang/nimsuggest/issues/83 seems fixed now

timotheecour commented 5 years ago

re-opening because of a new case that causes the crash: https://github.com/nim-lang/Nim/issues/9610

timotheecour commented 5 years ago

ok that bug was fixed; but to prevent future similar bugs, how about following:

timotheecour commented 5 years ago

/cc @Varriount I found a great workaround: install latest sublime dev channel https://www.sublimetext.com/3dev this build: BUILD 3179 introduced this feature:

Mac: Fixed a plugin_host crash when running a process that itself crashes

and I verified it fixes this issue on OSX

so I'll close this