Skip to content
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

yamux 0.10.1, set_split_send_size #2606

Closed
wants to merge 5 commits into from

Conversation

folex
Copy link
Contributor

@folex folex commented Apr 6, 2022

  • Update yamux to 0.10.1
  • Add set_split_send_size to YamuxConfig

As I understand, it affects #2461.

P.S. I'm kinda surprised you don't commit Cargo.lock, is there a reason for that? From my PoV, it makes CI builds unpredictable and generates hard-to-investigate dependency bugs.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

P.S. I'm kinda surprised you don't commit Cargo.lock, is there a reason for that? From my PoV, it makes CI builds unpredictable and generates hard-to-investigate dependency bugs.

This is a best practice as a library. Which dependency bug did you run into?

Cargo.toml Outdated Show resolved Hide resolved
@@ -290,6 +290,13 @@ impl YamuxConfig {
self
}

/// Set the max. payload size used when sending data frames. Payloads larger
/// than the configured max. will be split.
pub fn set_split_send_size(&mut self, n: usize) -> &mut Self {
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why do you need this flag?

Choose a reason for hiding this comment

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

We had a hard time debugging issue when we encountered UnexpectedEOF errors. Payload data was N * split_send_size, so we thought that it can affect the problem, and wondered why it is impossible to change this value. The reason was that we forgot to close stream after write and it got dropped immediately after write.

Regarding this issue, i thought that it can be useful to add panic, assert or at least warning when garbage collecting stream in "Open" state here. I have seen that you claim that poll_close must be called before dropping the stream here, so it may help users catch the same issue before it leads to serious consequences.

Choose a reason for hiding this comment

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

Also you can add a comment in the examples mentioning the importance of the closing of the socked, like here. I can make a PR or issue if you agree

Copy link
Member

Choose a reason for hiding this comment

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

Also you can add a comment in the examples mentioning the importance of the closing of the socked, like here. I can make a PR or issue if you agree

Sure. That sounds good to me @ValeryAntopol.

@folex folex force-pushed the yamux_set_split_send_size branch from 2467dbf to 1b4adae Compare April 7, 2022 08:17
@folex
Copy link
Contributor Author

folex commented Apr 8, 2022

This is a best practice as a library. Which dependency bug did you run into?

We're running build on nightly, so sometimes cargo update brings compilation errors. Without Cargo.lock commited, every build on CI is basically preceded by cargo update.

It's the usual practice to commit .lock files in JS and Haskell. But in Rust, Cargo book suggests against it for library authors. And it makes little sense to me, cuz Cargo.lock only affects CI/local builds, it doesn't affect publishing to crates.io.

So I'm curious on your reasons to do that :)

@folex folex requested a review from mxinden April 8, 2022 16:18
@folex
Copy link
Contributor Author

folex commented Apr 19, 2022

@mxinden anything else I can do to merge this PR?

@mxinden
Copy link
Member

mxinden commented Apr 23, 2022

It's the usual practice to commit .lock files in JS and Haskell. But in Rust, Cargo book suggests against it for library authors. And it makes little sense to me, cuz Cargo.lock only affects CI/local builds, it doesn't affect publishing to crates.io.

So I'm curious on your reasons to do that :)

No particular reasoning on my end other than following the best practice. I guess it does reduce the maintenance work a bit as one does not need to keep it up to date, e.g. via Dependabot.

@mxinden
Copy link
Member

mxinden commented Apr 23, 2022

@mxinden anything else I can do to merge this PR?

I still don't understand why you need to configure this flag. Can you expand on that once more? I am reluctant to add a configuration flag just for the sake of debugging.

@folex
Copy link
Contributor Author

folex commented Apr 25, 2022

@mxinden anything else I can do to merge this PR?

I still don't understand why you need to configure this flag. Can you expand on that once more? I am reluctant to add a configuration flag just for the sake of debugging.

I needed it to overcome the issue as I described. I've no other use-case. In general, I feel that it should be possible to configure underlying mechanisms without going through rather hard process of forking the whole libp2p.

@thomaseizinger
Copy link
Contributor

This is a best practice as a library. Which dependency bug did you run into?

We're running build on nightly, so sometimes cargo update brings compilation errors. Without Cargo.lock commited, every build on CI is basically preceded by cargo update.

It's the usual practice to commit .lock files in JS and Haskell. But in Rust, Cargo book suggests against it for library authors. And it makes little sense to me, cuz Cargo.lock only affects CI/local builds, it doesn't affect publishing to crates.io.

So I'm curious on your reasons to do that :)

As library authors, we should strive for having our library work with as many version combinations as possible. Locking down dependencies to specific patch versions is not helpful in that regard.

By default, cargo uses the caret modifier for dependency versions, meaning it will only build against that exact version or newer patch versions.

Within semver, there should never be breaking changes within patch versions. I think it is useful to recommend against tracking Cargo.lock in Git for library authors because it has the ecosystem-wide effect that breaking API changes in patch versions are extremely rare and when they happen, they are detected very early. Libraries tend to have less dependencies so it is also easier for library authors to work out, which dependency is the problem instead of putting this burden onto the application projects.

@thomaseizinger thomaseizinger added the need/author-input Needs input from the original author label Nov 2, 2022
@github-actions github-actions bot added the Stale label Jan 2, 2023
@mergify
Copy link
Contributor

mergify bot commented Jan 2, 2023

This pull request has merge conflicts. Could you please resolve them @folex? 🙏

@github-actions github-actions bot removed the Stale label Jan 3, 2023
@folex folex closed this Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/author-input Needs input from the original author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants