Skip to content

cargo r --features=llvm -p wasmer-cli run --disable-cache cowsay aa - crashes occasionally #5877

@marxin

Description

@marxin

If run the command from the current main branch, sometimes I hit the following segfault:

$ cargo r --features=llvm -p wasmer-cli run --disable-cache cowsay aa
...
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f45e62989d3 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2  0x00007f45e623e3a0 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f45e622557a in __GI_abort () at abort.c:77
#4  0x00007f45e65a211e in __deregister_frame_info_bases (begin=<optimized out>) at /usr/src/debug/gcc/gcc/libgcc/unwind-dw2-fde.c:296
#5  __deregister_frame_info_bases (begin=<optimized out>) at /usr/src/debug/gcc/gcc/libgcc/unwind-dw2-fde.c:230
#6  0x00007f45e65c308a in __deregister_frame (begin=<optimized out>) at /usr/src/debug/gcc/gcc/libgcc/unwind-dw2-fde.c:311
#7  0x0000558cf6957081 in wasmer_compiler::engine::unwind::systemv::{impl#1}::drop (self=0x7f456409d6e0) at lib/compiler/src/engine/unwind/systemv.rs:261
#8  0x0000558cf694ff17 in core::ptr::drop_in_place<wasmer_compiler::engine::unwind::systemv::UnwindRegistry> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#9  0x0000558cf694f36f in core::ptr::drop_in_place<wasmer_compiler::engine::code_memory::CodeMemory> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#10 0x0000558cf695006d in core::ptr::drop_in_place<[wasmer_compiler::engine::code_memory::CodeMemory]> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#11 0x0000558cf6951d13 in alloc::vec::{impl#25}::drop<wasmer_compiler::engine::code_memory::CodeMemory, alloc::alloc::Global> (self=0x558d09921878)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3804
#12 0x0000558cf6950ed7 in core::ptr::drop_in_place<alloc::vec::Vec<wasmer_compiler::engine::code_memory::CodeMemory, alloc::alloc::Global>> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#13 0x0000558cf694ea8b in core::ptr::drop_in_place<wasmer_compiler::engine::inner::EngineInner> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#14 0x0000558cf69511ab in core::ptr::drop_in_place<core::cell::UnsafeCell<wasmer_compiler::engine::inner::EngineInner>> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#15 0x0000558cf694b38f in core::ptr::drop_in_place<std::sync::poison::mutex::Mutex<wasmer_compiler::engine::inner::EngineInner>> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#16 0x0000558cf692b4a2 in alloc::sync::Arc<std::sync::poison::mutex::Mutex<wasmer_compiler::engine::inner::EngineInner>, alloc::alloc::Global>::drop_slow<std::sync::poison::mutex::Mutex<wasmer_compiler::engine::inner::EngineInner>, alloc::alloc::Global> (self=0x558d0988aa08)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1943
#17 0x0000558cf6951f8d in alloc::sync::{impl#38}::drop<std::sync::poison::mutex::Mutex<wasmer_compiler::engine::inner::EngineInner>, alloc::alloc::Global> (
    self=0x558d0988aa08) at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2686
#18 0x0000558cf694bf9b in core::ptr::drop_in_place<alloc::sync::Arc<std::sync::poison::mutex::Mutex<wasmer_compiler::engine::inner::EngineInner>, alloc::alloc::Global>> () at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#19 0x0000558cf694e43b in core::ptr::drop_in_place<wasmer_compiler::engine::inner::Engine> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#20 0x0000558cf57d3a49 in core::ptr::drop_in_place<wasmer::entities::engine::inner::BackendEngine> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#21 0x0000558cf57d329b in core::ptr::drop_in_place<wasmer::entities::engine::Engine> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#22 0x0000558cf51e9b33 in core::ptr::drop_in_place<wasmer_wasix::runtime::PluggableRuntime> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#23 0x0000558cf51a4ded in core::ptr::drop_in_place<(dyn wasmer_wasix::runtime::Runtime + core::marker::Send + core::marker::Sync)> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#24 0x0000558cf5287280 in alloc::sync::Arc<(dyn wasmer_wasix::runtime::Runtime + core::marker::Send + core::marker::Sync), alloc::alloc::Global>::drop_slow<(dyn wasmer_wasix::runtime::Runtime + core::marker::Send + core::marker::Sync), alloc::alloc::Global> (self=0x7f456d1e2fc8)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1943
#25 0x0000558cf51fb41d in alloc::sync::{impl#38}::drop<(dyn wasmer_wasix::runtime::Runtime + core::marker::Send + core::marker::Sync), alloc::alloc::Global> (
    self=0x7f456d1e2fc8) at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2686
#26 0x0000558cf51ae33b in core::ptr::drop_in_place<alloc::sync::Arc<(dyn wasmer_wasix::runtime::Runtime + core::marker::Send + core::marker::Sync), alloc::alloc::Global>> () at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524
#27 0x0000558cf4ca8603 in wasmer_wasix::bin_factory::exec::call_module (ctx=..., store=..., handle=..., rewind_state=..., recycle=...)
    at lib/wasix/src/bin_factory/exec.rs:393
#28 0x0000558cf4ca2622 in wasmer_wasix::bin_factory::exec::run_exec (props=...) at lib/wasix/src/bin_factory/exec.rs:231
#29 0x0000558cf5199b8d in core::ops::function::FnOnce::call_once<fn(wasmer_wasix::runtime::task_manager::TaskWasmRunProperties), (wasmer_wasix::runtime::task_manager::TaskWasmRunProperties)> () at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
#30 0x0000558cf519690c in core::ops::function::FnOnce::call_once<fn(wasmer_wasix::runtime::task_manager::TaskWasmRunProperties), (wasmer_wasix::runtime::task_manager::TaskWasmRunProperties)> () at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
#31 0x0000558cf529b909 in alloc::boxed::{impl#28}::call_once<(wasmer_wasix::runtime::task_manager::TaskWasmRunProperties), (dyn core::ops::function::FnOnce<(wasmer_wasix::runtime::task_manager::TaskWasmRunProperties), Output=()> + core::marker::Send), alloc::alloc::Global> (self=..., args=...)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1966
#32 0x0000558cf536fda1 in wasmer_wasix::runtime::task_manager::tokio::{impl#8}::task_wasm::{closure#2} () at lib/wasix/src/runtime/task_manager/tokio.rs:300
#33 0x0000558cf519657e in core::ops::function::FnOnce::call_once<wasmer_wasix::runtime::task_manager::tokio::{impl#8}::task_wasm::{closure_env#2}, ()> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
#34 0x0000558cf546ae48 in alloc::boxed::{impl#28}::call_once<(), (dyn core::ops::function::FnOnce<(), Output=()> + core::marker::Send), alloc::alloc::Global> (
    self=..., args=()) at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1966
#35 0x0000558cf54739b6 in rusty_pool::Worker::exec_task_and_notify (self=0x7f456d1e7580, sentinel=0x7f456d1e74c0, task=...) at src/lib.rs:1119
#36 0x0000558cf5473641 in rusty_pool::{impl#10}::start::{closure#0} () at src/lib.rs:1085
#37 0x0000558cf5463f26 in std::sys::backtrace::__rust_begin_short_backtrace<rusty_pool::{impl#10}::start::{closure_env#0}, ()> (
    f=<error reading variable: Cannot access memory at address 0x3f8604>)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152
#38 0x0000558cf547a4ba in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<rusty_pool::{impl#10}::start::{closure_env#0}, ()> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:559
#39 0x0000558cf54617a1 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rusty_pool::{impl#10}::start::{closure_env#0}, ()>> (self=...)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272
#40 0x0000558cf54641cc in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rusty_pool::{impl#10}::start::{closure_env#0}, ()>>, ()> (data=0x7f456d1e7918)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589
#41 0x0000558cf547accb in __rust_try ()
#42 0x0000558cf5479efa in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rusty_pool::{impl#10}::start::{closure_env#0}, ()>>> (f=...)
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552
#43 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rusty_pool::{impl#10}::start::{closure_env#0}, ()>>, ()> (f=...) at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359
#44 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<rusty_pool::{impl#10}::start::{closure_env#0}, ()> ()
    at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:557
#45 0x0000558cf546490f in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<rusty_pool::{impl#10}::start::{closure_env#0}, ()>, ()> () at /home/marxin/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
#46 0x0000558cf7fa373b in alloc::boxed::{impl#28}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> ()
    at library/alloc/src/boxed.rs:1966
#47 alloc::boxed::{impl#28}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> ()
    at library/alloc/src/boxed.rs:1966
#48 std::sys::pal::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/pal/unix/thread.rs:97
#49 0x00007f45e629698b in start_thread (arg=<optimized out>) at pthread_create.c:448
#50 0x00007f45e631a9cc in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Based on me experiments, it's related to LLVM compiler only.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions