I created a wrapper over a pair of SendStream and RecvStream to use tokio::io::copy_bidirectional on them. Since tokio::io::copy_bidirectional returns error immediately after encountering error on any direction without gracefully shutting down the other direction, I sometimes needs to manually close the other one. However, there is no way to distinguish which one should I close, it is required to explicitly close both one. Unfortunately, the SendStream may already been closed by tokio::io::copy_bidirectional, and calling close on it multiple times would cause panic. Additionally, the panicked thread holds the MutexGuard, which causes the lock poisoning and crashes the whole program.
I think the behavior should be consist of
reset()
. The panic is caused byhttps://github.com/quinn-rs/quinn/blob/4b309cd46b5a68c96c105b00dfbc65216523677f/quinn/src/send_stream.rs#L143C11-L160
which polls and unwraps a used oneshot receiver.
I created a wrapper over a pair of
SendStream
andRecvStream
to usetokio::io::copy_bidirectional
on them. Sincetokio::io::copy_bidirectional
returns error immediately after encountering error on any direction without gracefully shutting down the other direction, I sometimes needs to manually close the other one. However, there is no way to distinguish which one should I close, it is required to explicitly close both one. Unfortunately, theSendStream
may already been closed bytokio::io::copy_bidirectional
, and calling close on it multiple times would cause panic. Additionally, the panicked thread holds theMutexGuard
, which causes the lock poisoning and crashes the whole program.