-
Notifications
You must be signed in to change notification settings - Fork 255
RLS stops working after some time of use #425
Comments
@vorner what about put such rls into #!/bin/sh
RUST_LOG=debug path/to/real/rls $@ > /tmp/rls.log 2>&1 ? And look what is inside |
If you run Cargo outside the RLS it should put its data in a separate target dir from the RLS. The only overlap is if you run cargo clean, that will destroy all data including the RLS's. The RLS shouldn't be bothered my source code complexity - it just uses the compiler, so at worst we should just get sub-optimal data. It is possible that running the RLS on incorrect syntax causes problems. We try to cope, but there are a lot of edge cases and its possible we're hitting something bad. I'm not sure how NeoVim handles logging. It might be easier to try to repro in VSCode (or try @Dushistov's log file suggestion). You can set RUST_LOG=info or trace to get more info (we tend to use debug messages only for erros). |
Thank you for the suggestions, I'll try the shell script thing once I get to coding again during the next week. I kind of expected something more sophisticated and this simple thing so this simple one didn't cross my mind O:-) I'll get back soon with some data. |
I experience the same issue. Two days ago it worked, now i cannot use go-to-definition. I use newest rustc Edit: code completion seems to be working though |
I didn't manage to catch it happening again yet. However, there's another important bit of information that might be relevant. I have |
OK, I have a log now. I think there's something relevant (some errors and then backtraces), and I hope this'll help someone with the knowledge of rls's code. |
So the root cause here seems to be Cargo not being able to find a fingerprint it thinks it should be able to:
There were a lot of compile errors earlier, I think in the aggregator crate, but not 100% sure, and then the following:
Note that the hashes for the crate are different in these earlier logs than they are in the missing file error. I would usually expect the RLS to cope with compile errors, but perhaps the fact that this is happening across crates is confusing? @vorner are you working with multiple crates here? Which is the crate that you were editing and which is the crate that the RLS is watching? |
If by multiple crates you mean a workspace, then no. It's a single crate, but it has both lib and bin. However, I was editing only the lib and I didn't touch the bin at all at the time (the bin is just a thin wrapper). I have no Yes, when I edit, I often have a lot of compilation errors. I was refactoring at that time, so whenever I change a type or something, it causes errors across several files. The project is here, if you want to look at the layout or if I'm unclear about anything: https://gitlab.labs.nic.cz/turris/pakon-aggregator. |
It really seems to be somehow related to #!/bin/sh
RUST_LOG=info CARGO_INCREMENTAL=0 nice -n2 rustup run nightly rls "$@" 2>"$HOME"/.rls.log and I haven't seen it crash since (it's 2 days now). That doesn't necessarily mean anything (it didn't crash that often), but it feels the problem went away. The other compilations and the rest of my environment still runs with |
Also, if you want to look into it, that project switched to workspace mode since the report. The 15382717abbaea169b544d6d6e9416fb4fae79b8 commit should still be before the switch. |
Using the wrapper above I was able to a log from a crash I'm able to consistently duplicate. Initially I'd mistaken it for a Gnome-Builder crash and logged the steps here The root cause always seems to be auto-completing matching braces on macros. Well, in this case at least.
Edit: a second crash with different log output
|
I checked out the given commit and when I run the RLS I get a warning that Cargo failed on a dependent crate due to a compile error. Since the RLS doesn't have a dep, it can't build the main crate so there is no type info etc. However, this is expected behaviour, we emit a warning and we don't crash. I think the problem before was that we used to crash in this situation. |
Hello
I'm afraid I don't have much information about why it happens or exactly when. But here is my problem.
I start nvim and do some editing. RLS works fine for a while. But after some time, it just stops doing anything ‒ no suggestions are provided, it just sits there between processes and nothing happens. The only way to bring it back to life is to stop and start nvim again. Then, rls launches large amount of
rustc
compilers and starts working again.Some things that might be relevant:
cargo watch --no-restart -x test --all
, which attempts to run the tests every time I save the file. That one often fails when I save the file with syntax errors (I save often, sometimes in the middle of a statement, etc). I don't know if the tests destroy some of the analyses stored somewhere when this happens.To be clear, I understand it is problematic doing analysis on syntactically incorrect code, but what I find annoying is the fact RLS doesn't recover after I fix the code.
Versions:
I understand this report is of little use as it is, because there's not much info. I'd try to debug it, but I don't really know where to start and I didn't find any docs how to get some kind of log file from it, or something. So, is there some experiment I might run to get something useful out of it?
The text was updated successfully, but these errors were encountered: