-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
[fix] should not break directly #1849
Conversation
Thanks! We should probably have a regression test for this... |
I realized that the error is not coming from func |
It's hard for me to provide a regression test for my PR, but it does solve my problem temporarily. |
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.
It's not clear what this change is intended to accomplish, but its effect is solely to disable intended behavior. Refer to the comments on MAX_PADDING
just above your change. Perhaps you could start by describing the problem you're having?
quinn-proto/src/connection/mod.rs
Outdated
@@ -693,17 +693,15 @@ impl Connection { | |||
let packet_len_unpadded = cmp::max(builder.min_size, buf.len()) | |||
- datagram_start | |||
+ builder.tag_len; | |||
if packet_len_unpadded + MAX_PADDING < segment_size { | |||
if packet_len_unpadded + MAX_PADDING >= segment_size { |
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.
I expect this condition to be unsatisfiable. segment_size
is the maximum length packet assembly is permitted to produce.
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.
I'm sorry that you may be confusing. If this condition is always unsatisfiable, then the original condition is always true, and it means that we always execute original break
operation in its branch, which is incorrect.
In fact, segment_size
is exactly the maximum length, so it is always larger than packet_len_unpadded
. But the comparison add extra MAX_PADDING
to judge whether we skip amount of padding. Therefore, their sum may be larger than segment_size
and then the condition can be satisfiable is some case.
In original version, if the condition is satisfiable, we directly break
from the while
loop and execute the packet logic for the last packet. In current version, we just skip the padding operation builder.pad_to(segment_size as u16);
but keep all the following operations.
In short, the original version skip all the following operations, but the current version just skip the padding operation builder.pad_to(segment_size as u16);
.
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.
Please note that the involved commit is d5fc528.
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.
If this condition is always unsatisfiable, then the original condition is always true
Oops, yes, you're correct. Nonetheless, the original behavior is intended. The difference achieved by breaking here is what terminates the GSO batch, which is the purpose of this condition. Removing the break
allows the batch to continue with incorrect padding. This is why the tests are failing.
Thanks for your contribution, I use Quinn to implement a private proxy. Recently, I update Quinn to 0.11.0, but I cannot pass the test of I test your recent commits one by one using binary search (utilizing quinn={git="...", rev="..."}). I find that the first commit came from d5fc528. I attempt to review this commit and make a PR based on my understanding. |
I don't know what "the test of speedtest.net" is. An unexpected "stream reset by peer" error is almost certainly an application logic error. You should investigate why the sender is deciding to issue a reset.
This is most likely a coincidence arising from your application logic being timing-sensitive. |
Yes, you are right. I try to check again. |
Oh~~, I locate the bug, but I cannot fix it. I find the unit test Specifically, I run the command
After I delete the following code in the commit d5fc528. The unit test let packet_len_unpadded = cmp::max(builder.min_size, buf.len())
- datagram_start
+ builder.tag_len;
if packet_len_unpadded + MAX_PADDING < segment_size {
trace!(
"GSO truncated by demand for {} padding bytes",
segment_size - packet_len_unpadded
);
break;
}
|
Please check the unit test further. @Ralith |
I have fixed the unit test, and open a new PR #1853. |
We should invoke the
take
function forsent_frames
, which is the same as in lines 709 and 753.