mock-io
mock-io copied to clipboard
mock-io shows random stack traces for non running futures tasks
This may not be so much of a bug as much as an annoyance in my builds. To be sure my tests always pass and on random occasions the call to is_async() during read() causes the following stack trace to be also printed in the test result output:
thread 'test::test_empty' panicked at 'no Task is currently running', libcore/option.rs:1010:5
stack backtrace:
0: 0x1033b965f - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::he14a7566b
dd4ad59
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: 0x1033adacd - std::sys_common::backtrace::print::h1a7b3835c923145c
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: 0x1033bc6c3 - std::panicking::default_hook::{{closure}}::hf3ce01776f699802
at libstd/panicking.rs:211
3: 0x1033bc44c - std::panicking::default_hook::h3c82163ec405ace2
at libstd/panicking.rs:227
4: 0x1033bcdf7 - <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp
>::get::h171c0508ba0f257d
at libstd/panicking.rs:476
5: 0x1033bc95c - std::panicking::continue_panic_fmt::h99ced5a4f2cb7fe1
at libstd/panicking.rs:390
6: 0x1033bc848 - std::panicking::try::do_call::h227895fcedff86c1
at libstd/panicking.rs:325
7: 0x1033f9981 - core::ptr::drop_in_place::h4911d68bde261059
at libcore/panicking.rs:77
8: 0x1033f99f8 - core::ptr::drop_in_place::h4911d68bde261059
at libcore/option.rs:1010
9: 0x10322f4ae - futures::task_impl::core::is_get_ptr::he9f1821c3b760147
at libcore/option.rs:322
10: 0x10322d53d - core::sync::atomic::fence::hfe8e9abb8e00ad51
at /Users/sidharth/.cargo/registry/src/github.com-1ecc6299db9ec82
3/futures-0.1.25/src/task_impl/mod.rs:43
11: 0x10322d6c3 - core::sync::atomic::fence::hfe8e9abb8e00ad51
at /Users/sidharth/.cargo/registry/src/github.com-1ecc6299db9ec82
3/futures-0.1.25/src/task_impl/mod.rs:115
12: 0x10320a8d3 - mock_io::tokio::is_task_ctx::{{closure}}::h5833a77e05b3a583
at /Users/sidharth/.cargo/git/checkouts/mock-io-4da294547111861b/
f3ddbf1/src/lib.rs:494
13: 0x1032095ad - core::ptr::drop_in_place::hf9eeaa83057de510
at libstd/panicking.rs:310
14: 0x1033c8f5e - panic_unwind::dwarf::eh::read_encoded_pointer::hc34cd1841a9c3448
at libpanic_unwind/lib.rs:102
15: 0x103209488 - core::ptr::drop_in_place::hf9eeaa83057de510
at libstd/panicking.rs:289
16: 0x10320c0a3 - alloc::alloc::realloc::h925ba350de2998bc
at libstd/panic.rs:392
17: 0x10320a80f - mock_io::tokio::is_task_ctx::h1fc02f6b020dea65
at /Users/sidharth/.cargo/git/checkouts/mock-io-4da294547111861b/
f3ddbf1/src/lib.rs:494
18: 0x10320668d - mock_io::Mock::is_async::hb4e16b2b11688e96
at /Users/sidharth/.cargo/git/checkouts/mock-io-4da294547111861b/
f3ddbf1/src/lib.rs:193
19: 0x103206b2a - mock_io::Inner::action::hb2a7c897c61e0b3f
at /Users/sidharth/.cargo/git/checkouts/mock-io-4da294547111861b/
f3ddbf1/src/lib.rs:307
20: 0x10323c142 - kaleidoscope_rust::lexer::LexerUtils::is_valid_number::h013ea4e0eef20
77f
at src/lexer.rs:96
21: 0x1031c3033 - lexer::test::test_empty::ha383491365942f77
at tests/lexer.rs:56
22: 0x1031c3aa0 - lexer::test::test_empty::{{closure}}::h20d79d1f71ed6f75
at tests/lexer.rs:53
23: 0x1031c12b0 - core::ops::function::FnOnce::call_once::h197155977faf18fd
at libcore/ops/function.rs:238
24: 0x1031c54c1 - <F as alloc::boxed::FnBox<A>>::call_box::h3bcc9ca146dc16c0
at libtest/lib.rs:1468
at libcore/ops/function.rs:238
at liballoc/boxed.rs:672
25: 0x1033c8f5e - panic_unwind::dwarf::eh::read_encoded_pointer::hc34cd1841a9c3448
at libpanic_unwind/lib.rs:102
26: 0x1031e5d6c - std::sys_common::backtrace::__rust_begin_short_backtrace::h7a1f954d1c
2e46dd
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libtest/lib.rs:1423
at libstd/sys_common/backtrace.rs:136
27: 0x1031e6827 - std::panicking::try::do_call::h117606c4744e3cbc
at libstd/thread/mod.rs:409
at libstd/panic.rs:313
at libstd/panicking.rs:310
28: 0x1033c8f5e - panic_unwind::dwarf::eh::read_encoded_pointer::hc34cd1841a9c3448
at libpanic_unwind/lib.rs:102
29: 0x1031d3a54 - <F as alloc::boxed::FnBox<A>>::call_box::h7e8a9f097e3dc7dc
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libstd/thread/mod.rs:408
at liballoc/boxed.rs:672
30: 0x1033ab35b - std::sys::unix::thread::Thread::new::thread_start::hd0450e633b3bea88
at liballoc/boxed.rs:682
at libstd/sys_common/thread.rs:24
at libstd/sys/unix/thread.rs:90
31: 0x7fff97b74059 - _pthread_body
32: 0x7fff97b73fd6 - _pthread_start
A cursory reading lead me to believe that the framework is trying to detect if there is a future task which produces this panic. There is a warning there in that doc saying that calling this outside a poll(Future::poll, I think?) is dangerous. It seems that a code change is warranted but I am not sure I understand how to implement it.