emacs-lsp / emacs

Mirror of GNU Emacs
http://www.gnu.org/software/emacs/
GNU General Public License v3.0
71 stars 8 forks source link

Issues with ocamllsp #4

Open sebastiansturm opened 1 year ago

sebastiansturm commented 1 year ago

just a heads-up, as I haven't yet had time to look into this in detail: when trying to use ocamllsp with the latest implementation of native json-rpc (f34bbbdc8561f5e...), starting up the server will usually fail for me with "process TBD exited". One time I've also seen a crash while doing that, unfortunately ocamllsp worked fine when running emacs under gdb so I don't have a backtrace, and I assume this is a very timing-sensitive issue. A vanilla Emacs build without native json-rpc works as expected.

Since having a slower Emacs (gdb) seems to improve stability, I'll try slowing down the language server this evening by either recompiling it with different optimization settings or running it under strace/valgrind/whatever seems to work

yyoncho commented 1 year ago

I am having a similar issue (it does not start from time to time). I am still gaining knowledge of how to diagnose issues like that.

sebastiansturm commented 1 year ago

could it be that param->done sometimes starts out as true? AFAICS, the json rpc state is only malloc'ed without any explicit initialization of the done field, and param->done is checked before the first call to json_rpc_callback (which will then set the flag correctly)?

sebastiansturm commented 1 year ago

likewise, I'm sometimes seeing calls to ssp_recv with insane values of sz2 (18446744071878777500 in the log I'm currently looking at), which might be caused by error_buffer_read not being initialized on state construction? (guessing, haven't looked deeper into this yet as I'm currently at work)