I'm trying to write some multithreaded WebSocket code. I'm sending a Remote to another thread then calling spawn on it and sending a message inside the callback. For some reason, it works fine for a bit and then panics like this:
thread 'main' panicked at 'no Task is currently running', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.18/src/task_impl/mod.rs:44:8
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::begin_panic
6: futures::task_impl::current
7: <tokio_core::net::tcp::TcpStream as std::io::Write>::write
8: <tungstenite::protocol::frame::FrameSocket<Stream>>::write_pending
9: <tungstenite::protocol::WebSocket<Stream>>::send_one_frame
10: <tungstenite::protocol::WebSocket<Stream>>::write_pending
11: <F as tokio_core::reactor::FnBox>::call_box
12: tokio_core::reactor::Core::notify
13: tokio_core::reactor::Core::consume_queue
14: tokio_core::reactor::Core::poll
...
I'm not exactly sure how to debug this, especially since it only happens in a release build. Is it the case that there might not be a current task inside a call to "notify"? Is there any way to get it to be called inside a task? Or any way of adding extra debugging checks in tokio-core that could catch the issue?
Sorry to ask here but I'm not sure where to start. Please let me know if there's a better place to ask instead. I found https://github.com/rust-lang-nursery/futures-rs/issues/234 but I wasn't sure how to apply that to my situation. I'm not calling poll() or park() or anything, just core.run().
I'm trying to write some multithreaded WebSocket code. I'm sending a Remote to another thread then calling spawn on it and sending a message inside the callback. For some reason, it works fine for a bit and then panics like this:
I'm not exactly sure how to debug this, especially since it only happens in a release build. Is it the case that there might not be a current task inside a call to "notify"? Is there any way to get it to be called inside a task? Or any way of adding extra debugging checks in tokio-core that could catch the issue?
Sorry to ask here but I'm not sure where to start. Please let me know if there's a better place to ask instead. I found https://github.com/rust-lang-nursery/futures-rs/issues/234 but I wasn't sure how to apply that to my situation. I'm not calling poll() or park() or anything, just core.run().