- Notifications
You must be signed in to change notification settings - Fork 667
Open
Labels
A-channelArea: futures::channelArea: futures::channelfutures-0.1Issue related to the 0.1 versions of futuresIssue related to the 0.1 versions of futures
Description
When using grpcio we found that if poll mpsc::Receiver and mpsc::Sender in one thread, it could be blocked. We guess it's a bug of futures channel.
Here is a little demo to show it: https://github.com/hicqu/futures-mpsc-deadlock.
build: cargo build --release
run: ./target/release/futures-mpsc-deadlock
In my environment I can see the program is blocked forever.
With gdb to debug it, the stack is
(gdb) bt #0 0x00007f6f8617c41f in __lll_lock_wait () from /usr/lib/libpthread.so.0 #1 0x00007f6f86174ea3 in pthread_mutex_lock () from /usr/lib/libpthread.so.0 #2 0x000055a9a858364c in futures::sync::mpsc::Sender<T>::poll_unparked () #3 0x000055a9a8584eb2 in <futures::sink::send_all::SendAll<T,U> as futures::future::Future>::poll () #4 0x000055a9a8584c28 in <futures::future::map::Map<A,F> as futures::future::Future>::poll () #5 0x000055a9a8585abd in futures::task_impl::std::set () #6 0x000055a9a8586ba0 in <futures_mpsc_deadlock::Notifier<F> as futures::task_impl::Notify>::notify () #7 0x000055a9a85888f1 in futures::sync::mpsc::SenderTask::notify () #8 0x000055a9a8583fd0 in futures::sync::mpsc::Receiver<T>::next_message () #9 0x000055a9a85846a9 in <futures::sync::mpsc::Receiver<T> as futures::stream::Stream>::poll () #10 0x000055a9a858597c in futures::task_impl::std::set () #11 0x000055a9a8585f36 in futures::task_impl::Spawn<T>::poll_stream_notify () #12 0x000055a9a85870dd in futures_mpsc_deadlock::main () #13 0x000055a9a8584943 in std::rt::lang_start::{{closure}} () #14 0x000055a9a8591343 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:49 #15 std::panicking::try::do_call () at src/libstd/panicking.rs:296 #16 0x000055a9a8592b8a in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:80 #17 0x000055a9a8591e0d in std::panicking::try () at src/libstd/panicking.rs:275 #18 std::panic::catch_unwind () at src/libstd/panic.rs:394 #19 std::rt::lang_start_internal () at src/libstd/rt.rs:48 #20 0x000055a9a8587312 in main () Please take look if you are free, thanks!
Metadata
Metadata
Assignees
Labels
A-channelArea: futures::channelArea: futures::channelfutures-0.1Issue related to the 0.1 versions of futuresIssue related to the 0.1 versions of futures