What happened?
After successful installation of shuttle with command cargo install shuttle any attempt to run cargo shuttle ends with status -1 without additional logs.
e63906bf469a:/workspaces$ cargo shuttle login
Segmentation fault
Using strace to explore the issue I see this:
execve("/usr/local/cargo/bin/cargo-shuttle", ["/usr/local/cargo/bin/cargo-shutt"...], 0x7fffd9600720 /* 47 vars */) = 0
mmap(NULL, 1240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6eda7e3000
arch_prctl(ARCH_SET_FS, 0x7f6eda7e33f8) = 0
set_tid_address(0x7f6edbbb6c60) = 17793
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
and with valgrind:
==20295== Memcheck, a memory error detector
==20295== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==20295== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==20295== Command: /usr/local/cargo/bin/cargo-shuttle
==20295==
==20295== Jump to the invalid address stated on the next line
==20295== at 0x0: ???
==20295== by 0xB44E2F: ossl_init (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0xB19E2E: curl_global_init (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0x255EA3: std::sys_common::once::futex::Once::call (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0x270EDF: curl::INIT_CTOR::init_ctor (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0xFA4A83: libc_start_init (__libc_start_main.c:64)
==20295== by 0x270EFA: ??? (in /usr/local/cargo/bin/cargo-shuttle)
==20295== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==20295==
==20295==
==20295== Process terminating with default action of signal 11 (SIGSEGV)
==20295== Bad permissions for mapped region at address 0x0
==20295== at 0x0: ???
==20295== by 0xB44E2F: ossl_init (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0xB19E2E: curl_global_init (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0x255EA3: std::sys_common::once::futex::Once::call (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0x270EDF: curl::INIT_CTOR::init_ctor (in /usr/local/cargo/bin/cargo-shuttle)
==20295== by 0xFA4A83: libc_start_init (__libc_start_main.c:64)
==20295== by 0xFA4AA8: libc_start_main_stage2 (__libc_start_main.c:91)
==20295== by 0x270EFA: ??? (in /usr/local/cargo/bin/cargo-shuttle)
==20295==
==20295== HEAP SUMMARY:
==20295== in use at exit: 0 bytes in 0 blocks
==20295== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==20295==
==20295== All heap blocks were freed -- no leaks are possible
==20295==
==20295== For lists of detected and suppressed errors, rerun with: -s
==20295== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
So, it seems like the issue with openssl crate and specifically the issue with musl-based systems
Possible solutions are:
- Specify special rust flags to link with system's musl instead of bundled on install i.e.
RUSTFLAGS=-Ctarget-feature=-crt-static cargo install cargo-shuttle
- Enable feature
vendored-openssl for shuttle (or make it default feature) i.e. cargo install cargo-shuttle --features vendored-openssl (it requires perl and make tools to work)
- Install shuttle with binstall as it seems like prebuilt binary already built with
vendored-openssl i.e. cargo binstall cargo-shuttle
- As suggestend in issue replace openssl crate with another implementation
I solved the issue for myself, but perhaps to make life easier for others, some updates to the troubleshooting guide or any other actions should be taken.
Version
v0.11.2
Which operating systems are you seeing the problem on?
Linux
Which CPU architectures are you seeing the problem on?
x86_64
Relevant log output
No response
Duplicate declaration
What happened?
After successful installation of shuttle with command
cargo install shuttleany attempt to runcargo shuttleends with status -1 without additional logs.Using
straceto explore the issue I see this:and with
valgrind:So, it seems like the issue with
opensslcrate and specifically the issue with musl-based systemsPossible solutions are:
RUSTFLAGS=-Ctarget-feature=-crt-static cargo install cargo-shuttlevendored-opensslfor shuttle (or make it default feature) i.e.cargo install cargo-shuttle --features vendored-openssl(it requires perl and make tools to work)vendored-openssli.e.cargo binstall cargo-shuttleI solved the issue for myself, but perhaps to make life easier for others, some updates to the troubleshooting guide or any other actions should be taken.
Version
v0.11.2
Which operating systems are you seeing the problem on?
Linux
Which CPU architectures are you seeing the problem on?
x86_64
Relevant log output
No response
Duplicate declaration