-
Notifications
You must be signed in to change notification settings - Fork 925
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 a regression where response exceptions are logged unintentionally #6035
base: main
Are you sure you want to change the base?
Conversation
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.
👍👍
@@ -58,6 +58,7 @@ class HttpResponseWrapper implements StreamWriter<HttpObject> { | |||
private final EventLoop eventLoop; | |||
private final ClientRequestContext ctx; | |||
private final long maxContentLength; | |||
static final String UNEXPECTED_EXCEPTION_MSG = "Unexpected exception while closing a request"; |
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:
static final String UNEXPECTED_EXCEPTION_MSG = "Unexpected exception while closing a request"; | |
@VisibleForTesting | |
static final String UNEXPECTED_EXCEPTION_MSG = "Unexpected exception while closing a request"; |
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.
👍 👍 👍
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.
👍 👍 👍
Motivation:
We've received reports that the following log message is printed, and also exposed when completing the response exceptionally.
It seems like this is a regression of the refactoring done at: https://github.com/line/armeria/pull/5800/files#diff-d82983b1c20c5f80257da8c39bb74a80d49e81efceb7a1ce63847776de9b40a9R255
I propose that if an exception completes the corresponding
HttpResponse
andRequestLog
, then we don't log the exception inHttpResponseWrapper
Modifications:
boolean DefaultStreamMessage#tryClose
has been added which signals whether the call closed theStreamMessage
CancelledSubscriptionException
check has been moved totryClose
for more consistent behaviorHttpResponseWrapper#closeAction
actually closed the response, then return early so that a log isn't printedResult:
HttpResponseWrapper