-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
There was a problem hiding this 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?
@@ -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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
2467dbf
to
1b4adae
Compare
We're running build on nightly, so sometimes It's the usual practice to commit So I'm curious on your reasons to do that :) |
@mxinden anything else I can do to merge this PR? |
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. |
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. |
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. |
This pull request has merge conflicts. Could you please resolve them @folex? 🙏 |
set_split_send_size
toYamuxConfig
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.