-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
Hi, I'm trying to get started testing a custom mutex with loom. I have a draft PR here, where you can see the loom tests, and some functions I had to stub out (e.g. futex). https://github.com/shadow/shadow/pull/2553/files#diff-c8d75692cd8a476ff7f5af73e87d2d3567440ad8190c8bbad0e6493fa223b1da
First I run our build wrapper to pre-generate a header file:
./setup build
Then I'm trying to run loom with:
$ LOOM_CHECKPOINT_FILE=my_test.json RUST_BACKTRACE=full RUSTFLAGS="--cfg loom" cargo test --manifest-path=src/Cargo.toml -p shadow-shim-helper-rs --test loom_tests --release
I get:
...
running 2 tests
test test_basic ... ok
thread panicked while panicking. aborting.
error: test failed, to rerun pass `-p shadow-shim-helper-rs --test loom_tests`
Caused by:
process didn't exit successfully: `/home/jnewsome/projects/shadow/dev/src/target/release/deps/loom_tests-73d5a34e9486c4e8` (signal: 6, SIGABRT: process abort signal)
If I run the test directly under gdb I'm able to get a backtrace:
$ gdb /home/jnewsome/projects/shadow/dev/src/target/release/deps/loom_tests-73d5a34e9486c4e8
(gdb) run
Thread 3 "test_threads" received signal SIGABRT, Aborted.
[Switching to LWP 2178864]
0x00007ffff7d01a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff7d01a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7cad476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff7c937f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00005555556ac627 in std::sys::unix::abort_internal () at library/std/src/sys/unix/mod.rs:317
#4 0x00005555556a6c21 in std::panicking::rust_panic_with_hook () at library/std/src/panicking.rs:713
#5 0x00005555556a68c1 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/panicking.rs:586
#6 0x00005555556a4adc in std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure_env#0}, !> () at library/std/src/sys_common/backtrace.rs:138
#7 0x00005555556a6622 in std::panicking::begin_panic_handler () at library/std/src/panicking.rs:584
#8 0x00005555555a12b3 in core::panicking::panic_fmt () at library/core/src/panicking.rs:142
#9 0x00005555555a117d in core::panicking::panic () at library/core/src/panicking.rs:48
#10 0x0000555555604fc0 in loom::rt::object::Ref<T>::set_action ()
#11 0x000055555560a7c6 in scoped_tls::ScopedKey<T>::with ()
#12 0x00005555555fd6f7 in loom::rt::branch ()
#13 0x00005555555fcd4d in loom::rt::arc::Arc::ref_dec ()
#14 0x00005555555b33ac in <loom::sync::arc::Arc<T> as core::ops::drop::Drop>::drop ()
#15 0x00005555555aa473 in core::ptr::drop_in_place<loom::sync::arc::Arc<shadow_shim_helper_rs::scmutex::SelfContainedMutex<i32>>> ()
#16 0x00005555555aa085 in core::ops::function::FnOnce::call_once{{vtable.shim}} ()
#17 0x00005555555f87fd in generator::stack::StackBox$LT$F$GT$::call_once::h635448abd57c58fa ()
#18 0x000055555567ce71 in generator::gen_impl::gen_init ()
#19 0x0000000000000000 in ?? ()
It looks like loom::sync::Arc's drop implmentation is panicking...?
Here's a noisier / more-informative backtrace from a non-release build:
#0 0x00007ffff7d01a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7cad476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff7c937f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x000055555587e427 in std::sys::unix::abort_internal () at library/std/src/sys/unix/mod.rs:317
#4 0x0000555555878a21 in std::panicking::rust_panic_with_hook () at library/std/src/panicking.rs:713
#5 0x00005555558786c1 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/panicking.rs:586
#6 0x00005555558768dc in std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure_env#0}, !> () at library/std/src/sys_common/backtrace.rs:138
#7 0x0000555555878422 in std::panicking::begin_panic_handler () at library/std/src/panicking.rs:584
#8 0x00005555555c31b3 in core::panicking::panic_fmt () at library/core/src/panicking.rs:142
#9 0x00005555555c307d in core::panicking::panic () at library/core/src/panicking.rs:48
#10 0x000055555581be1d in core::option::Option<usize>::unwrap<usize> (self=...) at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:775
#11 0x00005555556767bd in loom::rt::thread::Set::active_mut (self=0x7ffff7a61880) at src/rt/thread.rs:259
#12 0x00005555556615c8 in loom::rt::object::Ref<loom::rt::arc::State>::set_action<loom::rt::arc::State> (self=..., execution=0x7ffff7a61850, action=..., location=...) at src/rt/object.rs:387
#13 0x0000555555660a8e in loom::rt::object::{impl#8}::branch_action::{closure#0}<loom::rt::arc::State, loom::rt::arc::Action> (execution=0x7ffff7a61850) at src/rt/object.rs:354
#14 0x000055555564e667 in loom::rt::branch::{closure#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()> (execution=0x7ffff7a61850)
at src/rt/mod.rs:119
#15 0x00005555556477ca in loom::rt::scheduler::{impl#0}::with_execution::{closure#0}<loom::rt::branch::{closure_env#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()>, ((), bool)> (state=0x7ffff7a611a0) at src/rt/scheduler.rs:48
#16 0x000055555564abed in loom::rt::scheduler::{impl#0}::with_state::{closure#0}<loom::rt::scheduler::{impl#0}::with_execution::{closure_env#0}<loom::rt::branch::{closure_env#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()>, ((), bool)>, ((), bool)> (state=0x7ffff7a61198) at src/rt/scheduler.rs:130
#17 0x0000555555657054 in scoped_tls::ScopedKey<core::cell::RefCell<loom::rt::scheduler::State>>::with<core::cell::RefCell<loom::rt::scheduler::State>, loom::rt::scheduler::{impl#0}::with_state::{closure_env#0}<loom::rt::scheduler::{impl#0}::with_execution::{closure_env#0}<loom::rt::branch::{closure_env#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()>, ((), bool)>, ((), bool)>, ((), bool)> (self=0x55555599ed28 <loom::rt::scheduler::STATE>, f=...) at /home/jnewsome/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.1/src/lib.rs:171
#18 0x0000555555649bb0 in loom::rt::scheduler::Scheduler::with_state<loom::rt::scheduler::{impl#0}::with_execution::{closure_env#0}<loom::rt::branch::{closure_env#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()>, ((), bool)>, ((), bool)> (f=...) at src/rt/scheduler.rs:130
#19 0x00005555556471d9 in loom::rt::scheduler::Scheduler::with_execution<loom::rt::branch::{closure_env#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()>, ((), bool)> (f=...) at src/rt/scheduler.rs:48
#20 0x0000555555653769 in loom::rt::execution<loom::rt::branch::{closure_env#0}<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()>, ((), bool)> (
f=...) at src/rt/mod.rs:171
#21 0x000055555564d769 in loom::rt::branch<loom::rt::object::{impl#8}::branch_action::{closure_env#0}<loom::rt::arc::State, loom::rt::arc::Action>, ()> (f=...) at src/rt/mod.rs:118
#22 0x000055555565fa98 in loom::rt::object::Ref<loom::rt::arc::State>::branch_action<loom::rt::arc::State, loom::rt::arc::Action> (self=..., action=loom::rt::arc::Action::RefDec, location=...)
at src/rt/object.rs:351
#23 0x0000555555645180 in loom::rt::arc::Arc::branch (self=0x7fffe800f980, action=loom::rt::arc::Action::RefDec, location=...) at src/rt/arc.rs:160
#24 0x0000555555644887 in loom::rt::arc::Arc::ref_dec (self=0x7fffe800f980, location=...) at src/rt/arc.rs:113
#25 0x00005555555da79e in loom::sync::arc::{impl#4}::drop<shadow_shim_helper_rs::scmutex::SelfContainedMutex<i32>> (self=0x7ffff7fb17b8)
at /home/jnewsome/.cargo/registry/src/github.com-1ecc6299db9ec823/loom-0.5.6/src/sync/arc.rs:246
#26 0x00005555555d94aa in core::ptr::drop_in_place<loom::sync::arc::Arc<shadow_shim_helper_rs::scmutex::SelfContainedMutex<i32>>> ()
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ptr/mod.rs:487
#27 0x00005555555e04a0 in loom_tests::test_threads::{closure#0} () at lib/shadow-shim-helper-rs/tests/loom_tests.rs:39
#28 0x00005555555ca7f4 in loom::model::{impl#0}::check::{closure#0}<loom_tests::test_threads::{closure_env#0}> ()
at /home/jnewsome/.cargo/registry/src/github.com-1ecc6299db9ec823/loom-0.5.6/src/model.rs:185
#29 0x00005555555d9301 in core::ops::function::FnOnce::call_once<loom::model::{impl#0}::check::{closure_env#0}<loom_tests::test_threads::{closure_env#0}>, ()> ()
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248
#30 0x000055555563067d in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> (self=..., args=())
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1940
#31 0x000055555564d468 in loom::rt::scheduler::spawn_threads::{closure#0}::{closure#0} () at src/rt/scheduler.rs:149
#32 0x0000555555642e7d in generator::gen_impl::{impl#9}::init_code::{closure#0}<core::option::Option<alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>>, (), loom::rt::scheduler::spawn_threads::{closure#0}::{closure_env#0}> () at /home/jnewsome/.cargo/registry/src/github.com-1ecc6299db9ec823/generator-0.7.1/src/gen_impl.rs:344
#33 0x000055555563646e in generator::stack::StackBox<generator::gen_impl::{impl#9}::init_code::{closure_env#0}<core::option::Option<alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>>, (), loom::rt::scheduler::spawn_threads::{closure#0}::{closure_env#0}>>::call_once<generator::gen_impl::{impl#9}::init_code::{closure_env#0}<core::option::Option<alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>>, (), loom::rt::scheduler::spawn_threads::{closure#0}::{closure_env#0}>> (data=0x7ffff7fb1e80)
at /home/jnewsome/.cargo/registry/src/github.com-1ecc6299db9ec823/generator-0.7.1/src/stack/mod.rs:139
#34 0x0000555555834fcc in generator::stack::Func::call_once (self=...) at src/stack/mod.rs:121
#35 0x0000555555834c33 in generator::gen_impl::gen_init::{closure#0} () at src/gen_impl.rs:560
#36 0x0000555555834423 in core::ops::function::FnOnce::call_once<generator::gen_impl::gen_init::{closure_env#0}, ()> ()
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248
#37 0x0000555555838bd1 in std::panicking::try::do_call<generator::gen_impl::gen_init::{closure_env#0}, ()> (data=0x7ffff7fb1d58)
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:492
#38 0x0000555555838c7b in __rust_try ()
#39 0x0000555555838b2f in std::panicking::try<(), generator::gen_impl::gen_init::{closure_env#0}> (f=...) at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:456
#40 0x00005555558385ff in std::panic::catch_unwind<generator::gen_impl::gen_init::{closure_env#0}, ()> (f=...) at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panic.rs:137
--Type <RET> for more, q to quit, c to continue without paging--
#41 0x000055555583498d in generator::gen_impl::catch_unwind_filter<generator::gen_impl::gen_init::{closure_env#0}, ()> (f=...) at src/gen_impl.rs:551
#42 0x0000555555834b47 in generator::gen_impl::gen_init (f=0x7ffff7fb1fa0) at src/gen_impl.rs:578
#43 0x0000000000000000 in ?? ()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels