Skip to content
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

Add debug logs for http2 stream errors #4515

Merged
merged 3 commits into from
Nov 7, 2022

Conversation

jrhee17
Copy link
Contributor

@jrhee17 jrhee17 commented Nov 2, 2022

Motivation:

We sometimes encounter situations where HTTP/2 header frames are lost due to an exception.
Although a RST frame is sent in this case, remotes are still able to send data for the offending stream, which ends up in error logs which armeria doesn't understand.

e.g.

io.netty.handler.codec.http2.Http2Exception: Stream 1147 does not exist

Although normally it might be noisy to be alerted of such failures, it might be useful to view such logs when debugging.

Modifications:

  • Added logging for HTTP/2 StreamError
  • Added logging for connection errors just in case as well.

Result:

  • Easier to debug http2 failure logs.

@jrhee17 jrhee17 added this to the 1.21.0 milestone Nov 2, 2022
Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines 115 to 117
if (logger.isDebugEnabled()) {
logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause);
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (logger.isDebugEnabled()) {
logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause);
}
logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause);

We use isDebugEnabled when it takes cost to create instances that are logged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I thought that there would be some cost if a throwable was passed in.
Went through the code and verified at least logback terminates early 👍

@jrhee17 jrhee17 marked this pull request as ready for review November 3, 2022 09:43
@@ -111,13 +112,20 @@ protected final void onConnectionError(ChannelHandlerContext ctx, boolean outbou

handlingConnectionError = true;
if (Exceptions.isExpected(cause) || isGoAwaySentException(cause, connection())) {
// Ignore silently.
logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause);
Copy link
Contributor

@ikhoon ikhoon Nov 3, 2022

Choose a reason for hiding this comment

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

As you know the error is safely ignored. How about setting the level to trace to log the cause only when users really want to delve into something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea 👍

@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Base: 74.05% // Head: 74.06% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (7d1fb8e) compared to base (8bc6f19).
Patch coverage: 49.25% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4515      +/-   ##
============================================
+ Coverage     74.05%   74.06%   +0.01%     
- Complexity    18167    18177      +10     
============================================
  Files          1536     1537       +1     
  Lines         67378    67426      +48     
  Branches       8520     8526       +6     
============================================
+ Hits          49894    49939      +45     
- Misses        13412    13418       +6     
+ Partials       4072     4069       -3     
Impacted Files Coverage Δ
...rp/armeria/client/ClientRequestContextWrapper.java 8.10% <0.00%> (ø)
...linecorp/armeria/common/RequestContextWrapper.java 9.75% <0.00%> (-2.44%) ⬇️
...p/armeria/common/stream/FilteredStreamMessage.java 79.57% <ø> (+1.40%) ⬆️
...a/internal/common/metric/RequestMetricSupport.java 93.80% <ø> (-0.17%) ⬇️
.../armeria/server/AggregatedHttpResponseHandler.java 76.82% <ø> (ø)
...p/armeria/server/ServiceRequestContextWrapper.java 9.43% <2.77%> (ø)
...armeria/server/EmptyContentDecodedHttpRequest.java 80.00% <80.00%> (-3.02%) ⬇️
...nternal/common/stream/EmptyFixedStreamMessage.java 76.00% <89.47%> (-7.34%) ⬇️
...m/linecorp/armeria/client/HttpResponseDecoder.java 85.38% <100.00%> (ø)
...rmeria/client/logging/ContentPreviewingClient.java 85.18% <100.00%> (+1.85%) ⬆️
... and 40 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

Thanks, @jrhee17!

@ikhoon ikhoon merged commit 1d6eb6f into line:master Nov 7, 2022
@ikhoon ikhoon modified the milestones: 1.21.0, 1.20.3 Nov 10, 2022
ikhoon added a commit to ikhoon/armeria that referenced this pull request Nov 10, 2022
Motivation:

When I changed the target version from 1.21.0 to 1.20.3, some PRs that
were already merged into the master branch hasn't changed.

Modifications:

- Add line#4515, line#4507, line#4484 and line#4492

Result:

Update missiong notes.
ikhoon added a commit that referenced this pull request Nov 11, 2022
Motivation:

When the target release version changed from 1.21.0 to 1.20.3, some PRs were already merged into the master branch. So their milestone should be changed and the release notes also need to be updated.

Modifications:

- Add #4515, #4507, #4484 and #4492 to the release notes.

Result:

Update the missing issues and PRs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants