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

cargo valgrind halts and catches fire even though I have valgrind installed? #106

Open
workingjubilee opened this issue Nov 28, 2024 · 5 comments

Comments

@workingjubilee
Copy link

$ RUST_BACKTRACE=full cargo valgrind
Oooops. cargo valgrind unexpectedly crashed. This is a bug!

This is an error in this program, which should be fixed. If you can, please submit a bug report at

    https://github.com/jfrimmel/cargo-valgrind/issues/new/choose

To make fixing the error more easy, please provide the information below as well as additional information on which project the error occurred or how to reproduce it.

cargo-valgrind: version 2.2.1
thread 'main' panicked at /home/jubilee/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-valgrind-2.2.1/src/main.rs:127:30:
Could not execute subcommand: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
   0:     0x58db00f99cd6 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9dff740d6699a4a3
   1:     0x58db00fbbd13 - core::fmt::write::h405f94e1289aa138
   2:     0x58db00f7c49f - std::io::Write::write_fmt::h927ba1da1a503d38
   3:     0x58db00f99b73 - std::sys::backtrace::BacktraceLock::print::hb6c2f528a894346c
   4:     0x58db00f8b38e - std::panicking::default_hook::{{closure}}::h55c73f2fbe5ce7fc
   5:     0x58db00f8b1a3 - std::panicking::default_hook::had1197a6b487ba38
   6:     0x58db00f4f8c7 - cargo_valgrind::panic::replace_hook::{{closure}}::h8ef61ae13f909380
   7:     0x58db00f8b90f - std::panicking::rust_panic_with_hook::h1b43f6801257ba51
   8:     0x58db00f9a09a - std::panicking::begin_panic_handler::{{closure}}::h3e6710bf0274d6f5
   9:     0x58db00f99ed9 - std::sys::backtrace::__rust_end_short_backtrace::h54384f38f0e8ee43
  10:     0x58db00f8b46c - rust_begin_unwind
  11:     0x58db00fbdc30 - core::panicking::panic_fmt::hd7c9cbd134eec45f
  12:     0x58db00fc75d6 - core::result::unwrap_failed::h752d82d4204beb8e
  13:     0x58db00f3fdeb - cargo_valgrind::main::he56d4d7302f54c63
  14:     0x58db00f45e73 - std::sys::backtrace::__rust_begin_short_backtrace::hca6489dccd0feffb
  15:     0x58db00f4a879 - std::rt::lang_start::{{closure}}::h7a7a74f1363663d6
  16:     0x58db00f895c0 - std::rt::lang_start_internal::h9c49934ec68a8718
  17:     0x58db00f400f5 - main
  18:     0x7ccd2a5ece08 - <unknown>
  19:     0x7ccd2a5ececc - __libc_start_main
  20:     0x58db00f32755 - _start
  21:                0x0 - <unknown>
$ valgrind --version
valgrind-3.24.0
@workingjubilee
Copy link
Author

And no, cargo valgrind run does not seem meaningfully different.

@jfrimmel
Copy link
Owner

Thanks for your report. Looks kind of funny, since this implies, that the tool cannot invoke itself as the driver?

if !driver::driver().expect("Could not execute subcommand") {

This suggests, that the issue is entirely unrelated to the valgrind-binary itself (the program crashes before even running valgrind).

Unfortunately, I cannot reproduce locally, so I have some questions:

  1. On which distribution are you running this?
  2. The stack trace suggest, that you run the tool installed via crates.io, is this correct?
  3. Which Rust version is used?

@workingjubilee
Copy link
Author

workingjubilee commented Nov 28, 2024

The stack trace suggest, that you run the tool installed via crates.io, is this correct?

Yes.

$ rustc --version --verbose
rustc 1.83.0-nightly (f7c53a2df 2024-11-25)
binary: rustc
commit-hash: f7c53a2df0aea1187879a37653480b31afb11417
commit-date: 2024-11-25
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

@workingjubilee
Copy link
Author

workingjubilee commented Nov 28, 2024

I use Arch Linux.

$ which cargo-valgrind
/home/jubilee/.cargo/bin/cargo-valgrind

@jfrimmel
Copy link
Owner

Hm, I've tried for a bit, but I cannot reproduce. I also use Arch Linux, hence our setup should be similar enough. Nevertheless, it works for me (a really bad sentence, I know):

$ cargo +nightly-2024-11-25 install cargo-valgrind
$ which cargo-valgrind
/home/jfrimmel/.cargo/bin/cargo-valgrind
$ cd tests/ffi-bug/
$ cargo +nightly-2024-11-25 valgrind run --example no-leak -q
Hello, world!
$ cargo +stable valgrind run --example no-leak -q
Hello, world!
       Error leaked 56 B in 1 block
        Info stack trace (user code at the bottom)
             <snip>
     Summary Leaked 56 B total (0 other errors)
$ valgrind --version
valgrind-3.24.0

I try a different setup, but would you mind running strace on it to see, where the the problem is located? Alternatively I can provide a branch with additional logging to narrow down the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants