-
Notifications
You must be signed in to change notification settings - Fork 953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libp2p_stream
stream deadlocks if using yamux 0.13
#5410
Comments
Hey! Thanks for the bug report. I noticed this last night when transmitting payloads more than 400KiB (though 512KiB or more can trigger it). This is with or without splitting the stream. Havent looked into it more myself but it does appear to only happen with /CC @mxinden |
I retraced the issue yesterday, I think. I think this has something to do with https://docs.rs/libp2p-yamux/latest/libp2p_yamux/struct.WindowUpdateMode.html#method.on_read (see the warning). The possibility of the deadlock occurring was presumably removed in libp2p/rust-yamux#177, but maybe that wasn't the complete reason for the deadlock? Might also be related to something completely different. |
Hmm very possible. I dont think ive ever experience a deadlock with yamux so its hard to really say. I know with |
@dariusc93 could you please take a look at libp2p/rust-yamux#193 ? |
Summary
It seems that the
yamux
multiplexer deadlocks if two streams are trying to change the window size at the same time. This is a problem with yamux 0.13 and yamux 0.12WindowUpdateMode::OnRead
. Changing the multiplexer tomplex
, setting it toWindowUpdateMode::OnReceive
, or switching to QUIC solves the problem. However, due to constraints in the system I am working on, either of these solutions is undesirable.The implementation where this behavior has been observed uses
libp2p_stream
and splits the resulting stream into a read-and-write half. This behavior has been observed when splittingAsyncRead/AsyncWrite
as well as when trying to split into separateStream/Sink
after running thelibp2p::Stream
through atokio-util
codec.This problem is observed when we
AsyncWrite
a large(-ish) (about 700KiB) quantity of data into theAsyncWrite
end; theAsyncWrite
handle then never terminates the.await
and is stuck forever.The
Stream/Sink
split is done using the following snippet of code:Expected behavior
Using the
yamux
multiplexer does not deadlock.Actual behavior
Using the
yamux
multiplexer deadlocks the connection.Relevant log output
After this, the connection gets stuck, and no progress is made on said connection, but
libp2p_ping
andyamux::connection::rtt
seem to continue to work and progress.Possible Solution
No response
Version
Would you like to work on fixing this bug ?
No
The text was updated successfully, but these errors were encountered: