Closed redtankd closed 8 years ago
edit: On second though, these issues probably aren't related, I'll make a new issue.
In writing a test case for the strange behaviour of timers with select, I also came across this error:
extern crate mioco;
fn main(){
mioco::start(move ||{
let mut timer_a = mioco::timer::Timer::new();
let mut timer_b = mioco::timer::Timer::new();
timer_a.set_timeout(1000);
timer_b.set_timeout(10);
loop{
use mioco::Evented;
unsafe{
timer_a.select_add(mioco::RW::read());
timer_b.select_add(mioco::RW::read());
}
let ret = mioco::select_wait();
if ret.id() == timer_a.id(){
println!("tick.. {}",timer_a.read());
timer_a.set_timeout(1000);
}
if ret.id() == timer_b.id(){
println!("tock.. {}",timer_b.read());
timer_b.set_timeout(1000);
}
}
}).unwrap();
}
Running `target/debug/mioco_timer`
tock.. SteadyTime(SteadyTime { tv_sec: 18885, tv_nsec: 515231715 })
tock.. SteadyTime(SteadyTime { tv_sec: 18886, tv_nsec: 515267592 })
tick.. SteadyTime(SteadyTime { tv_sec: 18886, tv_nsec: 515342030 })
tick.. SteadyTime(SteadyTime { tv_sec: 18887, tv_nsec: 515534829 })
thread '<main>' panicked at 'assertion failed: coroutine.last_event.id().as_usize() ==
self.shared().0.borrow().common.id.unwrap().as_usize()', /home/lewis/.multirust/toolchains/nightly/cargo/registry/src/github.com-88ac128001ac3a9a/mioco-0.4.1/src/evented.rs:58
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Any', ../src/libcore/result.rs:785
error: Process didn't exit successfully: `target/debug/mioco_timer` (exit code: 101)
Could you try if the fix for #125 did not fixed this one as well? It seems to me it does, but I might be wrong.
yes, it is fixed. thank u very much.
thread 'mioco_thread_1' panicked at 'assertion failed: coroutine.last_event.id().as_usize() == self.shared().0.borrow().common.id.unwrap().as_usize()', /Users/redtank/dev/git/3rd/mioco/src/evented.rs:58 stack backtrace: 1: 0x1056d7b38 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f 2: 0x1056d9ed5 - std::panicking::defaulthook::$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac 3: 0x1056d9b0e - std::panicking::default_hook::hc2c969e7453d080c 4: 0x1056ce3f6 - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25 5: 0x10554dd97 - std::sys_common::unwind::begin_unwind::h65390c63b501d6ed 6: 0x10559bac3 - mioco::src::evented::EventedImpl::block_onprv::h7a8d8cb88f24e91a 7: 0x10559b23b -::blockon::h1e279a08fb83196e
8: 0x1055a4acb - <mioco..MioAdapter as std..io..Read>::read::ha82f454170b1ba97
9: 0x1055a478e - _<std..io..BufReader as std..io..BufRead>::fill_buf::hc811fdaa004ac97b
10: 0x1055a4339 - std::io::read_until::h425b7f19190b8c10
11: 0x1055a3fd1 - std::io::BufRead::readline::$u7b$$u7b$closure$u7d$$u7d$::h7d5b831c6618ee34
12: 0x1055a3d7c - std::io::append_to_string::h5b65085600ba97b7
13: 0x1055a3d06 - std::io::BufRead::readline::h94ef60f891ce5cf3
14: 0x1055a0778 - test::ConnectionHandler::command::h72cbdb2c583004d5
15: 0x105598e57 - test::ConnectionHandler::run::h6f84bbaabdd71b7b
16: 0x105597440 - test::main::$u7b$$u7b$closure$u7d$$u7d$::$u7b$$u7b$closure$u7d$$u7d$::h1755119d9da0b0e6
17: 0x105597391 - <std..panic..AssertRecoverSafe as std..ops..FnOnce<()>>::callonce::h3ab9d376da01b702
18: 0x10559733a - mioco::src::coroutine::Coroutine::spawn::$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h1689735ffe5030b0
19: 0x105596e48 - std::panic::catchunwind::$u7b$$u7b$closure$u7d$$u7d$::ha0addfb34ed677d9
20: 0x105596df9 - std::sys_common::unwind::try::try_fn::hfb21ff1bd9094e8a
21: 0x1056d6d9b - __rust_try
22: 0x1056d6d23 - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
23: 0x105596d63 - std::sys_common::unwind::try::h929f127de1c2b766
24: 0x105596b45 - std::panic::catchunwind::hfd1424f66b3c2541
25: 0x105596a88 - std::panic::recover::hf41fcb160de33757
26: 0x105595a25 - mioco::src::coroutine::Coroutine::spawn::$u7b$$u7b$closure$u7d$$u7d$::h04a20bee2d4bfd7b
27: 0x105598154 - _<F as std..boxed..FnBox>::call_box::hab9acd65724e9105
28: 0x1055cc9f2 - mioco::src::coroutine::Coroutine::spawn::coroutine_context_start_fn::h114954b77f9d76e5