Skip to content

src/lib: Default to WindowUpdateMode::OnRead#120

Merged
mxinden merged 1 commit intolibp2p:developfrom
mxinden:default-on-read
Jun 8, 2021
Merged

src/lib: Default to WindowUpdateMode::OnRead#120
mxinden merged 1 commit intolibp2p:developfrom
mxinden:default-on-read

Conversation

@mxinden
Copy link
Member

@mxinden mxinden commented Jun 3, 2021

Default to WindowUpdateMode::OnRead, thus enabling full Yamux
flow-control, exercising back pressure on senders, preventing stream
resets due to reaching the buffer limit.

See the WindowUpdateMode documentation for details, especially the
section on deadlocking when sending data larger than the receivers
window.

This would prevent surprises like libp2p/rust-libp2p#2089.

Default to `WindowUpdateMode::OnRead`, thus enabling full Yamux
flow-control, exercising back pressure on senders, preventing stream
resets due to reaching the buffer limit.

See the [`WindowUpdateMode` documentation] for details, especially the
section on deadlocking when sending data larger than the receivers
window.

[`WindowUpdateMode` documentation]: https://docs.rs/yamux/0.9.0/yamux/enum.WindowUpdateMode.html
@mxinden mxinden requested a review from AgeManning June 3, 2021 09:06
Copy link

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with the intricacies here.

It does seem like in most cases the deadlock risk is unlikely compared the benefits in setting this to default, so makes sense to me.

@mxinden
Copy link
Member Author

mxinden commented Jun 4, 2021

Copy link

@koivunej koivunej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the ping @mxinden! Per your explanation this sounds very much a reasonable default but I don't have knowledge on yamux internals except for what I've learned by reading random issues.

@dvc94ch
Copy link

dvc94ch commented Jun 4, 2021

Seems ok. It's not a breaking change as it only affects the receiver behavior if I understand correctly. Thanks!

@mxinden mxinden merged commit d3685da into libp2p:develop Jun 8, 2021
mxinden added a commit to mxinden/rust-yamux that referenced this pull request Nov 23, 2023
Continuation of libp2p#120.

Preparation for libp2p#175.

Also removes dead-lock warning for `WindowUpdateMode::OnRead`. With the restructuring of
`Connection::poll`, one reads from the socket when writing is blocked. Thus the deadlock can not
occur.
mxinden added a commit that referenced this pull request Nov 24, 2023
Continuation of #120.

Preparation for #175.

Also removes dead-lock warning for `WindowUpdateMode::OnRead`. With the restructuring of
`Connection::poll`, one reads from the socket when writing is blocked. Thus the deadlock can not
occur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants