Rls: Consistent crash under VSCode, multiplatform

Created on 22 Jun 2017  路  12Comments  路  Source: rust-lang/rls

I have been getting an RLS crash consistently, after entering between five and ten keystrokes, with either the message:

thread '<unnamed>' panicked at 'calledResult::unwrap()on anErrvalue: InternalError("Out of bounds access inbyte_in_str")', /checkout/src/libcore/result.rs:860

or a message like:

Missing change, aborting. Found 126, expected Some(132) [Error - 8:14:01 PM] Connection to server got closed. Server will not be restarted.

The numbers change, but aside from that everything is consistent.

My code is:

#[macro_use] extern crate diesel_codegen;
#[macro_use] extern crate diesel;
extern crate dotenv;

pub mod schema;
pub mod models;

use diesel::prelude::*;
use diesel::pg::PgConnection;
use dotenv::dotenv;
use std::env;

pub fn establish_connection() -> PgConnection {
    dotenv().ok();

    let database_url = env::ver("DATABASE_URL")
        .expect("DATABASE_URL must be set");

    PgConnection::establish(&data)
}

Version info:

20:15:40: leo [~/Projects/vvs/vvs-server]
$ cargo -V
cargo 0.19.0 (28d1d60d4 2017-05-16)

20:15:43: leo [~/Projects/vvs/vvs-server]
$ rustc -V
rustc 1.18.0 (03fc9d622 2017-06-06)
bug P-high

All 12 comments

I'm having very similar issues within the VSCode Rust extension using Ubuntu 16.04.

Even messing around with a simple Hello World resulted in

Missing change, aborting. Found 2, expected Some(15)
[Error - 11:38:35 PM] Connection to server got closed. Server will not be restarted.

after ~10 keystrokes and 3 saves.

cargo 0.21.0-nightly (d26fd6f08 2017-06-20)
rustc 1.20.0-nightly (622e7e648 2017-06-21)

I also have this issue on Windows 10.

vscode-rust 0.4.0
rustc 1.20.0-nightly (622e7e648 2017-06-21)
cargo 0.21.0-nightly (d26fd6f08 2017-06-20)
rls 0.1.0-nightly (d26fd6f 2017-06-20)

I am having same problem on my Linux box

Linux Mint 18.1 Serena
vscode-rust 0.4.0
rustc 1.20.0-nightly (622e7e648 2017-06-21)
cargo 0.21.0-nightly (d26fd6f08 2017-06-20)
rls 0.1.0-nightly (d26fd6f 2017-06-20)

Error:

Missing change, aborting. Found 2, expected Some(3)
[Error - 3:30:18 PM] Connection to server got closed. Server will not be restarted.

This should be fixed on master now. If you've previously been able to repro, could you try with master?

@nrc
I am still getting a crash

Missing change, aborting. Found 2, expected Some(4)
[Error - 12:40:57 PM] Connection to server got closed. Server will not be restarted.

(sorry, this is my work github account)

Same here, crashes with latest nightly and VSCode with errors like this:

Missing change, aborting. Found 17, expected Some(42)
[Error - 9:42:54 PM] Connection to server got closed. Server will not be restarted.

Missing change, aborting. error is caused by processing edits out of order. Previously the implementation was (semi-)concurrent, but now it's sequential to conform to LSP spec, and the specific bit restarting the server has been removed in https://github.com/rust-lang-nursery/rls/commit/4971f65d97d2d9aa26d6d31e51ed99757dcbe59b. If you're using RLS with rustup, then I think you'll have to wait until rls module is updated there and distributed with the toolchain.

FWIW, I'm using the following combination (Win10 x64) and it's working great:

Thanks @dodheim . You will need to build from source to get this fix. I'll try and get this into rustup soon...

@dodheim - how do you configure vscode-rust to use rls built from source. Also, the rls binary built from source does not work unless I set the DYLD_LIBRARY_PATH. Is this configurable in the vscode plugin?

rls ashee$ ./target/debug/rls
dyld: Library not loaded: @rpath/librustc_driver-88a96c73e5ca34ca.dylib
  Referenced from: /Users/ashee/opt/rls/./target/debug/rls
  Reason: image not found
Abort trap: 6

Works with explicit DYLD_LIBRARY_PATH

rls ashee$ RUST_BACKTRACE=1 DYLD_LIBRARY_PATH=/Users/ashee/.rustup/toolchains/nightly-x86_64-apple-darwin/lib $HOME/opt/rls/target/debug/rls

@ashee : To use rls built from source I have the following in my settings.json:

"rust.rls": {
    "executable": "cargo",
    "args": ["+nightly", "run", "--manifest-path", "c:/Tools/rls/rls/Cargo.toml", "--release"]
}

N.b. you'll probably want to cargo build --release inside the rls/rls dir before launching VSCode so you can watch RLS' build progress.

Regarding DYLD_LIBRARY_PATH, I'm on Windows so I guess the counterpart would be PATH, and I have indeed altered my path to include %RUSTUP_HOME%/toolchains/nightly-x86_64-pc-windows-msvc/bin; so what you have looks correct to me. As to configuring it inside of VSCode, rust.rls in the settings has an env node, so something like this should work:

"rust.rls": {
    "executable": "cargo",
    "args": ["+nightly", "run", "--manifest-path", "$HOME/opt/rls/Cargo.toml", "--release"],
    "env": { "DYLD_LIBRARY_PATH": "$RUSTUP_HOME/toolchains/nightly-x86_64-apple-darwin/lib" }
}

@dodheim - perfect! thanks, it works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dpc picture dpc  路  4Comments

FrankvdStam picture FrankvdStam  路  3Comments

paulirotta picture paulirotta  路  3Comments

jamesmahler picture jamesmahler  路  5Comments

nrc picture nrc  路  6Comments