dpc/mioco

panic with the below test some times

Closed this issue · 1 comments

RUST_BACKTRACE=1 cargo test tx_inside_rx_inside_mioco

Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
 Running target/debug/deps/mioco-5839952be6ccc31d

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

 Running target/debug/deps/mpsc-acbd32c7554c8ddd

running 1 test
Apr 23 01:07:25.784 DEBG Creating mioco instance, mioco: 0.9.0-pre

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Empty', src/libcore/result.rs:859
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: <core::result::Result<T, E>>::unwrap
   1: mpsc::tx_inside_rx_inside_mioco::{{closure}}
   2: mioco::Fiber::new::{{closure}}::{{closure}}
   3: <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once
   4: std::panicking::try::do_call
   5: __rust_maybe_catch_panic
   6: std::panicking::try
   7: std::panic::catch_unwind
   8: mioco::Fiber::new::{{closure}}
   9: <mioco::thunk::Thunk<'a, (), R>>::new::{{closure}}
  10: <F as mioco::thunk::Invoke<A, R>>::invoke
  11: <mioco::thunk::Thunk<'a, A, R>>::invoke
  12: mioco::context_function

test tx_inside_rx_inside_mioco ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

dpc commented

I think you should use recv instead of try_recv. sleep might be not enough to guarantee the try_recv will succeed.