Open scw00 opened 1 year ago
Hi, is there any more document that explain how to use LOOM_LOG to debug my own app.
use loom::sync::atomic::AtomicUsize; use loom::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst}; use loom::sync::Arc; use loom::thread; #[test] fn buggy_concurrent_inc() { loom::model(|| { let v1 = Arc::new(AtomicUsize::new(0)); let v2 = v1.clone(); thread::spawn(move || { v1.store(1, SeqCst); }); loom::assert_eq //assert_eq!(0, v2.load(SeqCst)); }); }
---- tests::buggy_concurrent_inc::buggy_concurrent_inc stdout ---- INFO loom::model: INFO loom::model: ================== Iteration 1 ================== INFO loom::model: TRACE iter{1}: loom::rt::atomic: Atomic::new state=Ref<loom::rt::atomic::State>(0) TRACE iter{1}: loom::rt::arc: Arc::new state=Ref<loom::rt::arc::State>(1) location=src/tests/buggy_concurrent_inc.rs:9:18 TRACE iter{1}: loom::rt::object: Object::branch_action obj=Ref<loom::rt::arc::State>(1) action=RefInc TRACE iter{1}:thread{id=0}: loom::rt: branch switch=false TRACE iter{1}:thread{id=0}: loom::rt::arc: Arc::ref_inc state=Ref<loom::rt::arc::State>(1) ref_cnt=2 location=src/tests/buggy_concurrent_inc.rs:10:21 TRACE iter{1}:thread{id=0}: loom::rt::notify: Notify::new state=Ref<loom::rt::notify::State>(2) seq_cst=true spurious=false TRACE iter{1}:thread{id=0}: loom::rt: spawn thread=Id(1) TRACE iter{1}:thread{id=0}: loom::rt::object: Object::branch_action obj=Ref<loom::rt::arc::State>(1) action=RefDec INFO iter{1}:thread{id=1}: loom::rt::execution: ~~~~~~~~ THREAD 1 ~~~~~~~~ TRACE iter{1}:thread{id=1}: loom::rt: branch switch=true TRACE iter{1}:thread{id=1}: loom::rt::object: Object::branch_action obj=Ref<loom::rt::atomic::State>(0) action=Store TRACE iter{1}:thread{id=1}: loom::rt: branch switch=false TRACE iter{1}:thread{id=1}: loom::rt: synchronize TRACE iter{1}:thread{id=1}: loom::rt::atomic: Atomic::store state=Ref<loom::rt::atomic::State>(0) ordering=SeqCst TRACE iter{1}:thread{id=1}: loom::rt::object: Object::branch_action obj=Ref<loom::rt::arc::State>(1) action=RefDec TRACE iter{1}:thread{id=1}: loom::rt: branch switch=false TRACE iter{1}:thread{id=1}: loom::rt::arc: Arc::ref_dec state=Ref<loom::rt::arc::State>(1) ref_cnt=1 location=/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ptr/mod.rs:487:1 TRACE iter{1}:thread{id=1}: loom::rt::object: Object::branch_action obj=Ref<loom::rt::notify::State>(2) action=Opaque TRACE iter{1}:thread{id=1}: loom::rt: branch switch=false TRACE iter{1}:thread{id=1}: loom::rt: thread_done: drop locals thread=Id(1) INFO iter{1}:thread{id=0}: loom::rt::execution: ~~~~~~~~ THREAD 0 ~~~~~~~~ TRACE iter{1}:thread{id=0}: loom::rt: thread_done: terminate thread=Id(1) switch=true TRACE iter{1}:thread{id=0}: loom::rt::arc: Arc::ref_dec state=Ref<loom::rt::arc::State>(1) ref_cnt=0 location=/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ptr/mod.rs:487:1 TRACE iter{1}:thread{id=0}: loom::rt: thread_done: drop locals thread=Id(0) thread 'tests::buggy_concurrent_inc::buggy_concurrent_inc' panicked at 'Reached unexpected exploration state. Is the model fully deterministic?', /Users/chenwei.scw/.cargo/registry/src/github.com-1ecc6299db9ec823/loom-0.5.6/src/rt/path.rs:279:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hi, is there any more document that explain how to use LOOM_LOG to debug my own app.