rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.94k stars 12.78k forks source link

Random `SIGSEGV: invalid memory reference` after update to Sonoma 14.2 #119308

Open HoaPham98 opened 11 months ago

HoaPham98 commented 11 months ago

Problem

I used Ventura 13.2 and Xcode 14.3 on my M2 macbook to build without any problem, but since I updated to Sonoma 14.2 and Xcode 15, the problem appeared. After using cargo build command random dependencies throw SIGSEGV: invalid memory reference error randomly. I have to retry cargo build until it compile successfully.

Example output:

Compiling serde v1.0.193
   Compiling libc v0.2.151
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling version_check v0.9.4
   Compiling itoa v1.0.10
thread panicked while processing panic. aborting.
error: could not compile `proc-macro2` (build script)

Caused by:
  process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name build_script_build --edition=2021 /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.71/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=f50446ec8a171ff3 -C extra-filename=-f50446ec8a171ff3 --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/build/proc-macro2-f50446ec8a171ff3 -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: could not compile `once_cell` (lib)

Caused by:
  process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name once_cell --edition=2021 /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="race"' --cfg 'feature="std"' -C metadata=8960163d904fd82f -C extra-filename=-8960163d904fd82f --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --cap-lints allow` (signal: 6, SIGABRT: process abort signal)
error: could not compile `libc` (build script)

Caused by:
  process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name build_script_build /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.151/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=f769b7461e28a7c6 -C extra-filename=-f769b7461e28a7c6 --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/build/libc-f769b7461e28a7c6 -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
error: rustc interrupted by SIGSEGV, printing backtrace

error: could not compile `autocfg` (lib)

Caused by:
  process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name autocfg /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/autocfg-1.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C metadata=c259ddacc1677b72 -C extra-filename=-c259ddacc1677b72 --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
0   librustc_driver-b9265c333c46a764.dy 0x0000000109760ba0 _RNvNtCscRHTlojTVhD_17rustc_driver_impl14signal_handler17print_stack_trace + 52
1   libsystem_platform.dylib            0x0000000181051a24 _sigtramp + 56
2   dyld                                0x0000000180cafa78 _ZN5dyld412RuntimeState16_finalizeListTLVEPv + 116
3   dyld                                0x0000000180cafa78 _ZN5dyld412RuntimeState16_finalizeListTLVEPv + 116
4   libsystem_pthread.dylib             0x000000018101f978 _pthread_tsd_cleanup + 488
5   libsystem_pthread.dylib             0x0000000181022724 _pthread_exit + 84
6   libsystem_pthread.dylib             0x0000000181022040 _pthread_start + 148
7   libsystem_pthread.dylib             0x000000018101ce3c thread_start + 8

note: we would appreciate a report at https://github.com/rust-lang/rust
error: could not compile `version_check` (lib)

Caused by:
  process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name version_check /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/version_check-0.9.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C metadata=e21cba2a1838dbc6 -C extra-filename=-e21cba2a1838dbc6 --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)

Steps

  1. I use macbook pro m2 16gb ram with Sonoma 14.2 installed
  2. Clone this repo https://github.com/HoaPham98/voz-rust.git
  3. Use cargo build command

Version

rustc 1.74.1 (a28077b28 2023-12-04)
binary: rustc
commit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1
commit-date: 2023-12-04
host: aarch64-apple-darwin
release: 1.74.1
LLVM version: 17.0.4
HoaPham98 commented 11 months ago

Update more output

Output ```bash Compiling serde v1.0.193 Compiling clap_builder v4.4.11 error: could not compile `serde` (lib) Caused by: process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name serde --edition=2018 /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.193/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="serde_derive"' --cfg 'feature="std"' -C metadata=30dc497ad793661f -C extra-filename=-30dc497ad793661f --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --extern serde_derive=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps/libserde_derive-46877c079ba45593.dylib --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference) warning: build failed, waiting for other jobs to finish... thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/mod.rs:68:21: invalid enum variant tag while decoding `SpanEncodingMode`, expected 0..2, actual 105 stack backtrace: 0: 0x101d684d4 - ::fmt::h0524bd1b527203b8 1: 0x101dbbf50 - core::fmt::write::h74be1333b0a6ddea 2: 0x101d5e084 - std::io::Write::write_fmt::h6c011b665b2d7d4b 3: 0x101d68314 - std::sys_common::backtrace::print::he25ff7dac6402434 4: 0x101d6af10 - std::panicking::default_hook::{{closure}}::h41763ba018b93bf7 5: 0x101d6ac28 - std::panicking::default_hook::h017c44660373840e 6: 0x10a2b07fc - as core[2bcba5d0e4ff3e7b]::ops::function::Fn<(&dyn for<'a, 'b> core[2bcba5d0e4ff3e7b]::ops::function::Fn<(&'a core[2bcba5d0e4ff3e7b]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[2bcba5d0e4ff3e7b]::marker::Sync + core[2bcba5d0e4ff3e7b]::marker::Send, &core[2bcba5d0e4ff3e7b]::panic::panic_info::PanicInfo)>>::call 7: 0x101d6b6a8 - std::panicking::rust_panic_with_hook::h221a0baf52ecd48a 8: 0x101d6b474 - std::panicking::begin_panic_handler::{{closure}}::h18b661cf0f97a414 9: 0x101d68960 - std::sys_common::backtrace::__rust_end_short_backtrace::h4f4b2ffab2311217 10: 0x101d6b1e0 - _rust_begin_unwind 11: 0x101de72d0 - core::panicking::panic_fmt::hd6070cd222575be5 12: 0x10da155fc - >::decode 13: 0x10da9b8ec - >::decode 14: 0x10da3f208 - rustc_metadata[fe6165f61bb4e8d0]::rmeta::decoder::cstore_impl::provide_extern::def_span 15: 0x10d59dd18 - rustc_query_impl[9e7908c04f7afc6e]::plumbing::__rust_begin_short_backtrace::> 16: 0x10d6b4750 - >::call_once 17: 0x10d53d2cc - rustc_query_system[d39ef68513bd191c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[9e7908c04f7afc6e]::plumbing::QueryCtxt, false> 18: 0x10d5e6874 - rustc_query_impl[9e7908c04f7afc6e]::query_impl::def_span::get_query_non_incr::__rust_end_short_backtrace 19: 0x10c88ffe8 - rustc_middle[a287847c5569c060]::query::plumbing::query_get_at::>> 20: 0x10c893210 - rustc_ty_utils[a55c5e0e6f7456b6]::ty::param_env 21: 0x10d59e0d4 - rustc_query_impl[9e7908c04f7afc6e]::plumbing::__rust_begin_short_backtrace::> 22: 0x10d6b4b54 - >::call_once 23: 0x10d53d2cc - rustc_query_system[d39ef68513bd191c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[9e7908c04f7afc6e]::plumbing::QueryCtxt, false> 24: 0x10d5eb31c - rustc_query_impl[9e7908c04f7afc6e]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace 25: 0x10c8a3140 - rustc_middle[a287847c5569c060]::query::plumbing::query_get_at::>> 26: 0x10c8a72b4 - rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached::{closure#13} 27: 0x10c8a61f8 - rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached 28: 0x10c8a74d8 - rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of 29: 0x10d59dfbc - rustc_query_impl[9e7908c04f7afc6e]::plumbing::__rust_begin_short_backtrace::> 30: 0x10d668f6c - )>>::call_once 31: 0x10d51a690 - rustc_query_system[d39ef68513bd191c]::query::plumbing::try_execute_query::, rustc_middle[a287847c5569c060]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[9e7908c04f7afc6e]::plumbing::QueryCtxt, false> 32: 0x10d5ecff4 - rustc_query_impl[9e7908c04f7afc6e]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace 33: 0x10c8c23dc - as rustc_middle[a287847c5569c060]::ty::layout::LayoutOf>::spanned_layout_of 34: 0x10c8b2eb8 - core[2bcba5d0e4ff3e7b]::iter::adapters::try_process::, rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached::{closure#8}::{closure#0}>>, rustc_abi[c7f6e285ac763f2b]::Layout, core[2bcba5d0e4ff3e7b]::result::Result, , rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached::{closure#8}::{closure#0}> as core[2bcba5d0e4ff3e7b]::iter::traits::iterator::Iterator>::try_collect>::{closure#0}, rustc_index[297ba5d7b25bae1f]::vec::IndexVec> 35: 0x10c8b2d04 - core[2bcba5d0e4ff3e7b]::iter::adapters::try_process::, rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached::{closure#8}>>, rustc_index[297ba5d7b25bae1f]::vec::IndexVec, core[2bcba5d0e4ff3e7b]::result::Result, , rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached::{closure#8}> as core[2bcba5d0e4ff3e7b]::iter::traits::iterator::Iterator>::try_collect>>::{closure#0}, rustc_index[297ba5d7b25bae1f]::vec::IndexVec>> 36: 0x10c8a4e58 - rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of_uncached 37: 0x10c8a74d8 - rustc_ty_utils[a55c5e0e6f7456b6]::layout::layout_of 38: 0x10d59dfbc - rustc_query_impl[9e7908c04f7afc6e]::plumbing::__rust_begin_short_backtrace::> 39: 0x10d668f6c - )>>::call_once 40: 0x10d51a690 - rustc_query_system[d39ef68513bd191c]::query::plumbing::try_execute_query::, rustc_middle[a287847c5569c060]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[9e7908c04f7afc6e]::plumbing::QueryCtxt, false> 41: 0x10d5ecff4 - rustc_query_impl[9e7908c04f7afc6e]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace 42: 0x10a46471c - rustc_middle[a287847c5569c060]::query::plumbing::query_get_at::, rustc_middle[a287847c5569c060]::query::erase::Erased<[u8; 16usize]>>> 43: 0x10a4674cc - , rustc_codegen_ssa[b9be0c4ddea40530]::mir::analyze::non_ssa_locals::{closure#0}> as core[2bcba5d0e4ff3e7b]::iter::traits::iterator::Iterator>::fold::<(), core[2bcba5d0e4ff3e7b]::iter::traits::iterator::Iterator::for_each::call>::extend_trusted, rustc_codegen_ssa[b9be0c4ddea40530]::mir::analyze::non_ssa_locals::{closure#0}>>::{closure#0}>::{closure#0}> 44: 0x10a523994 - as alloc[e4017e615315a8cf]::vec::spec_from_iter::SpecFromIter, rustc_codegen_ssa[b9be0c4ddea40530]::mir::analyze::non_ssa_locals::{closure#0}>>>::from_iter 45: 0x10a470378 - rustc_codegen_ssa[b9be0c4ddea40530]::mir::analyze::non_ssa_locals:: 46: 0x10a53a47c - rustc_codegen_ssa[b9be0c4ddea40530]::mir::codegen_mir:: 47: 0x10a453394 - rustc_codegen_ssa[b9be0c4ddea40530]::base::codegen_instance:: 48: 0x10a4adb0c - rustc_codegen_llvm[22fab7a7205d590c]::base::compile_codegen_unit::module_codegen 49: 0x10a4ad4b4 - rustc_codegen_llvm[22fab7a7205d590c]::base::compile_codegen_unit 50: 0x10a452df0 - rustc_codegen_ssa[b9be0c4ddea40530]::base::codegen_crate:: 51: 0x10a4dd278 - ::codegen_crate 52: 0x10a412818 - ::time::, rustc_interface[8c1a14708701cb84]::passes::start_codegen::{closure#0}> 53: 0x10a3f4d4c - rustc_interface[8c1a14708701cb84]::passes::start_codegen 54: 0x10a416474 - ::enter::<::ongoing_codegen::{closure#0}, core[2bcba5d0e4ff3e7b]::result::Result, rustc_span[2c1d7be8ad5e9acc]::ErrorGuaranteed>> 55: 0x10a3e64c4 - ::ongoing_codegen 56: 0x10a2cebd0 - rustc_span[2c1d7be8ad5e9acc]::set_source_map::, rustc_interface[8c1a14708701cb84]::interface::run_compiler, rustc_driver_impl[95dc7b3c621a6063]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 57: 0x10a2ae718 - std[256f1ee5f6a5cea7]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[95dc7b3c621a6063]::run_compiler::{closure#1}>::{closure#0}, core[2bcba5d0e4ff3e7b]::result::Result<(), rustc_span[2c1d7be8ad5e9acc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2bcba5d0e4ff3e7b]::result::Result<(), rustc_span[2c1d7be8ad5e9acc]::ErrorGuaranteed>> 58: 0x10a2af838 - <::spawn_unchecked_, rustc_driver_impl[95dc7b3c621a6063]::run_compiler::{closure#1}>::{closure#0}, core[2bcba5d0e4ff3e7b]::result::Result<(), rustc_span[2c1d7be8ad5e9acc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2bcba5d0e4ff3e7b]::result::Result<(), rustc_span[2c1d7be8ad5e9acc]::ErrorGuaranteed>>::{closure#1} as core[2bcba5d0e4ff3e7b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 59: 0x101d74550 - std::sys::unix::thread::Thread::new::thread_start::h07b00985b5bfc467 60: 0x181022034 - __pthread_joiner_wake error: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.74.1 (a28077b28 2023-12-04) running on aarch64-apple-darwin note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [def_span] looking up span for `alloc::collections::TryReserveError` #1 [param_env] computing normalized predicates of `alloc::collections::TryReserveError` #2 [layout_of] computing layout of `alloc::collections::TryReserveError` #3 [layout_of] computing layout of `core::result::Result<(), alloc::collections::TryReserveError>` end of query stack error: could not compile `clap_builder` (lib) Caused by: process didn't exit successfully: `/Users/hoapq2/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name clap_builder --edition=2021 /Users/hoapq2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.4.11/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=132 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="cargo"' --cfg 'feature="color"' --cfg 'feature="error-context"' --cfg 'feature="help"' --cfg 'feature="std"' --cfg 'feature="suggestions"' --cfg 'feature="usage"' -C metadata=0dee6d88642c843b -C extra-filename=-0dee6d88642c843b --out-dir /Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps -L dependency=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps --extern anstream=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps/libanstream-8a6efaacf8617bcd.rmeta --extern anstyle=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps/libanstyle-9672e953c52e1dcd.rmeta --extern clap_lex=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps/libclap_lex-84c61e89c35d7f29.rmeta --extern strsim=/Users/hoapq2/Desktop/RustyVoz/vozrs/target/debug/deps/libstrsim-d78477d270ebfea4.rmeta --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference) ```
DianQK commented 11 months ago

Could you try nightly or beta? Or provide a reproduction?

HoaPham98 commented 11 months ago

hi @DianQK , I tried with nightly but same issue. Updated the reproduction steps

DianQK commented 11 months ago

hi @DianQK , I tried with nightly but same issue. Updated the reproduction steps

I can't reproduce it with Ventura 13.5.1. After upgrade, I can't reproduce either with macOS 14.2.1 (23C71) & Xcode 15.1 (15C65). Maybe you could update it first?

HoaPham98 commented 11 months ago

hi @DianQK , I tried with nightly but same issue. Updated the reproduction steps

I can't reproduce it with Ventura 13.5.1. After upgrade, I can't reproduce either with macOS 14.2.1 (23C71) & Xcode 15.1 (15C65). Maybe you could update it first?

No luck, still crash with similar messages :(