jaredly / jaredly/reason-language-server
RLS exiting when recompiling a large project
- Dominant language
- OCaml
- Stars
- 649
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to integrate RLS with LanguageClient-neovim. The client will run perfeectly when I start reading a reason file and I will get the appropriate errors and warnings, if they are already in the file. But RLS exits if I save the file after making changes to it a couple of times with the following backtrace:
````
>> Fatal error: Longident.flat
Fatal error: exception Compiler_libs_406.Misc.Fatal_error
Raised at file "ocaml_typing/406/misc.ml", line 21, characters 54-71
Called from file "ocaml_typing/406/longident.ml" (inlined), line 26, characters 18-29
Called from file "process_ocaml/406/ProcessExtra.re", line 267, characters 54-76
Called from file "ocaml_typing/406/typedtreeIter.ml", line 559, characters 6-29
Called from file "ocaml_typing/406/typedtreeIter.ml", line 198, characters 6-45
Called from file "list.ml", line 110, characters 12-15
Called from file "ocaml_typing/406/typedtreeIter.ml", line 203, characters 6-43
Called from file "ocaml_typing/406/typedtreeIter.ml", line 142, characters 34-64
Called from file "list.ml", line 110, characters 12-15
Called from file "process_ocaml/406/ProcessExtra.re", line 579, characters 2-44
Called from file "process_ocaml/406/ProcessExtra.re", line 613, characters 5-62
Called from file "process_ocaml/406/Process_406.re", line 19, characters 23-71
Called from file "src/analyze/AsYouType.re", line 230, characters 26-58
Called from file "src/analyze/State.re", line 274, characters 21-532
Called from file "src/lsp/Diagnostics.re", line 43, characters 27-75
Called from file "src/lsp/Diagnostics.re", line 81, characters 25-62
Called from file "hashtbl.ml", line 317, characters 23-40
Called from file "hashtbl.ml", line 324, characters 14-35
Re-raised at file "hashtbl.ml", line 330, characters 4-13
Called from file "src/lsp/Diagnostics.re", line 78, characters 16-414
Called from file "src/lsp/BasicServer.re", line 105, characters 16-27
Called from file "src/lsp/Main.re", line 313, characters 6-255
Called from file "bin/Bin.re", line 3, characters 9-24
````
I am using bs-platform@7.2.2 in my project.
**UPDATE 1**
In my lsp logs, I see something like Ident!!! being printed. The RLS server is exiting whenever the number of times this log line is printed hits 127.
grep 'Ident' /Users/porter/work/ThePorter/SpotCRM/node_modules/.lsp/debug.log | wc -l
**UPDATE 2**
The issue gets fixed if I just remove the line:
````
List.iter(Iter.iter_structure_item, items);
````
from `/process_ocaml/406/ProcessExtra.re`
Would greatly appreciate it if someone could explain what does this `Iter.iter_structure_item` operation does?
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the crash by repeatedly saving a large Reason project through LanguageClient-neovim, then inspect process_ocaml/406/ProcessExtra.re around lines 267 and 579-613, including Iter.iter_structure_item. Trace the Ident logging and the call from src/analyze/AsYouType.re; done means recompilation no longer exits and diagnostics continue after repeated saves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100