Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault Compiling Rust Completer #3040

Closed
landersson opened this issue May 27, 2018 · 7 comments
Closed

Segfault Compiling Rust Completer #3040

landersson opened this issue May 27, 2018 · 7 comments

Comments

@landersson
Copy link

landersson commented May 27, 2018

Hi,

I'm getting a segmentation fault when trying to build the rust completer under Mac OS X 10.11.6 using rust stable 1.26:

Running `/Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/build/libracerd-575086e0e3f82a44/build-script-build`
error: failed to run custom build command for `libracerd v0.3.3 (file:///Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd)`
process didn't exit successfully: `/Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/build/libracerd-575086e0e3f82a44/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)

Looking at the backtrace, it seems to be related to serde:

(gdb) bt
#0  0x00000001001e6782 in syntex_syntax::attr::mk_attr_id::he4ed48d103165959 ()
#1  0x00000001000da465 in syntex::registry::Registry::add_attr::hb32c401bb765a68d ()
#2  0x0000000100037fc4 in serde_codegen::syntex_registry::ha9b6b03e61114f5f ()
#3  0x0000000100008c3a in std::sys_common::backtrace::__rust_begin_short_backtrace::h8ad45ce89ecd74f1 ()
#4  0x00000001000081f8 in std::panicking::try::do_call::h5433abda0ba4336f ()
#5  0x0000000100389f0f in __rust_maybe_catch_panic () at libpanic_unwind/lib.rs:102
#6  0x0000000100010ee8 in _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h2843c289271ef279 ()
#7  0x000000010037d888 in from_error<std::sys::unix::fd::FileDesc,std::io::error::Error> () at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:1209
#8  {{closure}} () at libstd/sys/unix/fd.rs:220
#9  call_once<closure,(i32)> () at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:223
#10 and_then<i32,std::io::error::Error,std::sys::unix::fd::FileDesc,closure> () at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:621
#11 std::sys_common::thread::start_thread::hffc3810a6e03b74d () at libstd/sys/unix/fd.rs:244
#12 0x000000010036cc19 in unwrap_or_else<*mut u8,core::heap::AllocErr,closure> () at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:748
#13 exchange_malloc () at /Users/travis/build/rust-lang/rust/src/liballoc/heap.rs:241
#14 new<std::error::{{impl}}::from::StringError> () at /Users/travis/build/rust-lang/rust/src/liballoc/boxed.rs:243
#15 from () at libstd/error.rs:195
#16 std::sys::unix::thread::Thread::new::thread_start::hbd2eb72915a2a86e () at libstd/error.rs:225
#17 0x00007fff903e399d in ?? ()

If anyone is planning to look into this, let me know if I can provide you with any additional information.

Btw, I realise this could very well be a rust compiler issue rather than a YCM issue.

@micbou
Copy link
Collaborator

micbou commented May 27, 2018

I can't reproduce with the same version of Rust on macOS 10.13.4. Maybe the segfault is due to a lack of memory? Could you paste the full output of the build to see when the segfault occurs? You can specifically compile the Rust completer with the following command:

./install.py --skip-build --no-regex --rust-completer

@landersson
Copy link
Author

Looking a bit closer, it's not the rust compiler that is crashing, but a binary called "build-script-build", built from "build.rs", and that I assume is part of the build process:

Rustc compiling "build-script-build":

Runningrustc --crate-name build_script_build build.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=575086e0e3f82a44 -C extra-filename=-575086e0e3f82a44 --out-dir /Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/build/libracerd-575086e0e3f82a44 -L dependency=/Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/deps --extern serde_codegen=/Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/deps/libserde_codegen-c190851d0098ff18.rlib

Segfault when "build-script-build" is being run:

Running/Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/build/libracerd-575086e0e3f82a44/build-script-builderror: failed to run custom build command forlibracerd v0.3.3 (file:///Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd)process didn't exit successfully:/Users/larsandersson/dot-files/vim/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/build/libracerd-575086e0e3f82a44/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)

@micbou
Copy link
Collaborator

micbou commented May 28, 2018

I suppose this line is causing the segfault. When building the Rust completer, the script is actually moving to the directory YouCompleteMe/third_party/ycmd/third_party/racerd and running the command

cargo build --release

Do you still get the segfault if you build racerd without the --release flag? By the way, could you paste the output of cargo --version and rustc --version?

@landersson
Copy link
Author

No segfault when building without --release. The whole build finishes successfully.

racerd:>rustc --version
rustc 1.26.0 (a77568041 2018-05-07)

cargo --version
cargo 1.26.0 (0e7c5a931 2018-04-06)

@micbou
Copy link
Collaborator

micbou commented May 28, 2018

This may be related to issue rust-lang/rust#50586. Could you try with Rust 1.25.0?

@landersson
Copy link
Author

You're probably right, it works with rust 1.25.0. That solves the issue for me. Thanks.

@micbou
Copy link
Collaborator

micbou commented May 29, 2018

Closing as a Rust compiler issue then.

@micbou micbou closed this as completed May 29, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants