Skip to content

Flush parent before reading on H2 connection #1557

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

Merged
merged 1 commit into from
Dec 26, 2019

Conversation

dagnir
Copy link
Contributor

@dagnir dagnir commented Dec 23, 2019

Description

It's possible that WINDOW_UPDATE in the outbound buffer is not be written in a
timely manner to the socket, causing subsequent read()'s to hang until the
remote endpoint sees the local window increase.

Motivation and Context

Testing

New unit and integ tests. Running full integ and benchmark suites.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@@ -172,6 +173,9 @@ private boolean tryConfigurePipeline() {
}

pipeline.addLast(LastHttpContentHandler.create());
if (Protocol.HTTP2.equals(protocol)) {
pipeline.addLast(FlushOnReadHandler.getInstance());
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to remove FlushOnReadHandler from the pipeline when we release the channel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! good catch.

ctx.channel().parent().flush();
}

public static FlushOnReadHandler getInstance() {
Copy link
Contributor

Choose a reason for hiding this comment

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

create to be consistent with other static factory method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have both :)

My preference is for getInstance

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but we are using create in core consistently and I'd prefer using create going forward since this naming convention is written in our design doc. :)

https://github.com/aws/aws-sdk-java-v2/blob/master/docs/design/FavorStaticFactoryMethods.md#naming-conventions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The key phrase is is "new instance" though. getInstance() makes it explicit that it's a singleton instance

@codecov-io
Copy link

Codecov Report

Merging #1557 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1557      +/-   ##
============================================
+ Coverage      75.4%   75.47%   +0.07%     
  Complexity      771      771              
============================================
  Files           884      884              
  Lines         27568    27625      +57     
  Branches       2155     2172      +17     
============================================
+ Hits          20787    20850      +63     
+ Misses         5786     5785       -1     
+ Partials        995      990       -5
Flag Coverage Δ Complexity Δ
#unittests 75.47% <100%> (+0.07%) 771 <0> (ø) ⬇️
Impacted Files Coverage Δ Complexity Δ
...o/netty/internal/http2/HttpOrHttp2ChannelPool.java 93% <100%> (+0.36%) 0 <0> (ø) ⬇️
...tomization/CodegenCustomizationProcessorChain.java 81.81% <0%> (-8.19%) 0% <0%> (ø)
...on/awssdk/protocols/ion/AwsIonProtocolFactory.java 72.72% <0%> (-5.06%) 0% <0%> (ø)
.../software/amazon/awssdk/core/sync/RequestBody.java 89.65% <0%> (-3.21%) 0% <0%> (ø)
...ftware/amazon/awssdk/codegen/internal/Jackson.java 59.09% <0%> (-2.82%) 0% <0%> (ø)
...on/awssdk/codegen/internal/DocumentationUtils.java 75% <0%> (-2.42%) 0% <0%> (ø)
...db/mappingclient/extensions/WriteModification.java 52% <0%> (-2.17%) 5% <0%> (ø)
...rvices/s3/internal/ConfiguredS3SdkHttpRequest.java 46.15% <0%> (-1.85%) 0% <0%> (ø)
...amodb/mappingclient/operations/ConditionCheck.java 41.66% <0%> (-1.2%) 3% <0%> (ø)
...mappingclient/operations/GlobalSecondaryIndex.java 29.03% <0%> (-0.97%) 5% <0%> (ø)
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1d5f24...8559bf8. Read the comment docs.

It's possible that WINDOW_UPDATE in the outbound buffer is not be written in a
timely manner to the socket, causing subsequent read()'s to hang until the
remote endpoint sees the local window increase.
@dagnir dagnir force-pushed the h2-flush-before-read branch from d80ef4e to 219c46f Compare December 26, 2019 19:19
@dagnir dagnir merged commit 27773f4 into aws:master Dec 26, 2019
@dagnir dagnir deleted the h2-flush-before-read branch December 26, 2019 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants