-
Notifications
You must be signed in to change notification settings - Fork 910
Bug fix for S3AsyncClient.putObject hangs if there is a connection reset set while uploading of object #3535
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
Conversation
f30a6e2
to
8d076f8
Compare
@@ -211,7 +213,7 @@ private void handleCancelled(ChannelHandlerContext ctx, InT msg) { | |||
private void handleReadHttpContent(ChannelHandlerContext ctx, HttpContent content) { | |||
if (!ignoreBodyRead) { | |||
if (content instanceof LastHttpContent) { | |||
|
|||
ctx.channel().attr(LAST_HTTP_CONTENT_RECEIVED_KEY).set(true); |
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.
This is a nice simplification of the logic.
Do we want to move the logging statement over 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.
done, added Debug log same as before
8d076f8
to
fd1287e
Compare
…set while uploading of objects
fd1287e
to
267eee9
Compare
@@ -211,7 +215,8 @@ private void handleCancelled(ChannelHandlerContext ctx, InT msg) { | |||
private void handleReadHttpContent(ChannelHandlerContext ctx, HttpContent content) { | |||
if (!ignoreBodyRead) { | |||
if (content instanceof LastHttpContent) { | |||
|
|||
ctx.channel().attr(LAST_HTTP_CONTENT_RECEIVED_KEY).set(true); |
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.
Do we know in what situations ignoreBodyRead
is set to true?
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.
ignoreBodyRead
is true when we get 200 OK and there is nothing to read
Example
ignoreBodyRead in False state while handleReadHttpContent
In the case of GetObject
- We get 200 OK
- Then we read the data
- Last byte received
Now since get has data to read the ignoreBodyRead
is in false state because this fails.
When set to true
In the case of PutObject
- We get 200 OK
- Then we SEND the data, nothing to read from service
- Last byte received
Now since Put has no data to read the ignoreBodyRead
is in true state because this passes.
It makes sense to set the LastByte flag true irrespective of ignoreBodyRead
status
/** | ||
* {@link AttributeKey} to keep track of whether we have received the {@link LastHttpContent}. | ||
*/ | ||
public static final AttributeKey<Boolean> LAST_HTTP_CONTENT_RECEIVED_KEY = NettyUtils.getOrCreateAttributeKey( |
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.
Should we rename it to STREAMING_COMPLETE_KEY
? Alternatively, we can update the description of this field to make it clear that it indicates streaming has finished
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.
Done
import org.reactivestreams.Subscription; | ||
import software.amazon.awssdk.http.async.SdkHttpContentPublisher; | ||
|
||
public class SdkTestHttpContentPublisher implements SdkHttpContentPublisher { |
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.
Can we use the existing SimpleHttpContentPublisher
or something from RxJava?
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.
SimpleHttpContentPublisher
is in core and netty didnot have core dependency, I did not find anything from RxJava, will keep looking out for 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.
Added SimpleHttpContentPublisher in http-client-tests
since adding in test-utils
is casuing cyclic dependency.
0c1e18b
to
be709d2
Compare
…E_KEY and setting it irrespective of ignoreBodyRead flag
be709d2
to
e4af9ba
Compare
if (content instanceof LastHttpContent) { | ||
|
||
if (lastHttpContent) { | ||
logger.debug(ctx.channel(), () -> "Received LastHttpContent " + ctx.channel()); |
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.
Maybe moving this log statement to line 218?
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.
Done
SonarCloud Quality Gate failed. |
…5b148a627 Pull request: release <- staging/42c674bc-70ed-49a8-9013-a745b148a627
Motivation and Context
Root Cause
HttpResponseStatus CONTINUE = newStatus(100, "Continue")
is received , which actually ignores the body, sends the lastByte and immediately starts reading the request stream.Modifications
LAST_HTTP_CONTENT_RECEIVED_KEY
for read specific case when there is a GET request and data is read , this will not impact PUT request where request streams are read even after receiving Last byte as part of put requestTesting
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License