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

[Bug]: Segmentation fault error when running cargo shuttle #720

Closed
1 task done
meskill opened this issue Mar 16, 2023 · 2 comments
Closed
1 task done

[Bug]: Segmentation fault error when running cargo shuttle #720

meskill opened this issue Mar 16, 2023 · 2 comments
Labels
S-Investigation This issue needs further investigation or design to figure out a solution T-Bug Something isn't working

Comments

@meskill
Copy link

meskill commented Mar 16, 2023

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:

  1. 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
  2. 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)
  3. Install shuttle with binstall as it seems like prebuilt binary already built with vendored-openssl i.e. cargo binstall cargo-shuttle
  4. 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

  • I have searched the issues and there are none like this.
@meskill meskill added the T-Bug Something isn't working label Mar 16, 2023
@oddgrd
Copy link
Contributor

oddgrd commented Mar 17, 2023

Thank you for this and for investigating the cause @meskill, this is a great bug report! We'll take a closer look at this after the upcoming release which is due on monday. 🙏

@jonaro00 jonaro00 added the S-Investigation This issue needs further investigation or design to figure out a solution label Aug 17, 2023
@jonaro00
Copy link
Member

Closing since we are no longer using openssl in cargo-shuttle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Investigation This issue needs further investigation or design to figure out a solution T-Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants