-
Notifications
You must be signed in to change notification settings - Fork 75
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
Complete stream write ChannelFuture
on the actual write of a Muxer frame
#316
Comments
The fix complicated by the following: jvm-libp2p/libp2p/src/main/kotlin/io/libp2p/etc/util/netty/mux/MuxChannel.kt Lines 35 to 52 in 0981ec6
Not sure if the |
Another potential problem: |
Test and draft attempt trying to address the issue: ad6c2d3 |
The issue closely relates to #282
The problem:
When writing anything to a stream [child]
Channel
there is an associatedChannelFuture
(either passed to or returned from the correspondingwrite()
method).That
ChannelFuture
should be completed when the associated message buffer is flushed to the wire. In other words when the associated muxer frame(s) write operation is completed. In yet other words when any buffer(s) associated with the message are released.That allows various backpressure mechanisms to function correctly on the client side
Currently a stream write
ChannelFuture
is completed earlier here:jvm-libp2p/libp2p/src/main/kotlin/io/libp2p/etc/util/netty/mux/MuxChannel.kt
Line 47 in 0981ec6
So it happens effectively right upon a stream
Channel.flush()
call. Thus even when the client code is respecting backpressure, i.e. writes the next chunk of data (e.g. writes the next Ethereum block in a batch) only after the previous write was completed, it could still overflow write buffers.E.g. for the
mplex
muxer internal Netty write buffers are filled up if the remote reader is slower than local writerE.g. for the
yamux
muxer it's internal stream write buffer is filled upThe text was updated successfully, but these errors were encountered: