Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Close an HTTP/1.1 connection after delay #5616
Close an HTTP/1.1 connection after delay #5616
Changes from 22 commits
5b6a9fd
f01ca8a
824bb23
1d764aa
5820fe9
4a7f0ef
90b5509
ae86f29
e74d182
4ec928d
abbfc56
f2c64e6
29308dd
a0c1787
f966235
38d644e
e0155d7
5e25804
151ff7a
12a536d
bbc35b7
cd2d1a4
32cda15
83d7ba2
4a9496f
3b45ee8
51986e3
596b223
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit:
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.
Thank you for helping to correct 🙇
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.
nit, can we just explicitly check each line?
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 refactored it too 🙇
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.
Question) I didn't understand the intention of this test. If the functionality isn't very different from
shouldDelayDisconnectByServerSideIfClientDoesNotHandleConnectionClose
, what do you think of just removing it?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.
The
shouldWaitForDisconnectByClientSideFirst
test checks if the server sends theConnection: close
header and waits for the client to close the connection first, rather than closing the connection immediately. It additionally checks if the server closes the connection after the client closes it.On the other hand, the
shouldDelayDisconnectByServerSideIfClientDoesNotHandleConnectionClose
test verifies that if the client receives theConnection: close
header but ignores it without attempting to close the connection, and the close connection task scheduled by the server executes well waiting for the set time on the sever side before closing the connection.Therefore, I wrote two tests because I think the purpose of the two tests and what they verify are different.
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 see, I think I missed that point in the last review cycle. Thanks for the explanation 👍
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.
ditto
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 changed it to read reads each line!
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.
So that we know why this logic exists
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.
Thanks for good suggestions 🙇
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.
Question) I think the previous approach of collecting all bytes was correct (in the off-chance that the bytes are fragmented). What do you think of reverting this file?
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.
Due to the following implementation, the
ByteStreams.toByteArray(s.getInputStream())
call returns the value when the inputStream is closed which is only happened when the connection is closed from the server.https://github.com/google/guava/blob/master/guava/src/com/google/common/io/ByteStreams.java#L195~L198
With this PR, I changed the server to wait for the client to close first instead of closing the connection immediately. However in this test, the client receives the
Connection: Close
header from the server but ignores it. So the test waits for the server to close the connction, causing the test timeout.I tried to adjust the
defaultHttp1ConnectionCloseDelayMillis
using@SetSystemProperty
orSystem.setProperty()
to reduce the test time, but it didn't work well in shadedTest 😭Since only the first line is needed for this test validation, I changed it to read only the first line and check the result to make the test take less time.
If it is a problem, I would consider reducing the
defaultHttp1ConnectionCloseDelayMillis
.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 see, I think I missed this point. I think it's fine to leave as-is then. Thanks for the explanation 👍
I assume this is because
Flags
is already initialized when other tests are run orServerExtension
is constructed.