-
Notifications
You must be signed in to change notification settings - Fork 918
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
More robust resolution/rejection of a promise #77
Conversation
b7608bc
to
e0ebe1a
Compare
I wonder if we should make all timeout exceptions stacktraceless to avoid the overhead. Thoughts? |
@trustin,if the |
67c20c4
to
c7622ab
Compare
@hepin1989 Yep. Made the change in TimeoutException already. |
c7622ab
to
3de0489
Compare
} | ||
|
||
try { | ||
if (!(promise.cause() instanceof TimeoutException)) { |
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 think timeouts should still be logged to info
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.
Or maybe they're already logged in timeout handler? If so then it's ok, I guess it's very exceptional to even get to this code.
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.
TimeoutException
has already failed the promise. This if
block is to swallow the result arrived after the timeout.
Armeria does not log any exceptions raised by a Service
implementation. It uses the exceptions to produce proper error responses, and that's all. To log any exceptions raised by a Service
, you'll have to decorate it. e.g. using LoggingService
.
3de0489
to
2124170
Compare
Motivation: When a client does not receive a response or a server fails to process a request within time limit, an invocation promise is rejected regardless the final outcome of the invocation. In such a case, a ServiceInvocationHandler or a remote invoker implementation might attempt to resolve or reject the promise which is already rejected with TimeoutException. Handling this sort of situations is very common, and thus we should provide it as part of Armeria. Modifications: - Add ServiceInvocationContext.resolvePromise() and rejectPromise() to provide a simple and robust way to resolve or reject a promise in a ServiceInvocationHandler - Use resolvePromise() and rejectPromise() wherever possible. - Miscellaneous: - Fix a bug where WriteTimeoutException is raised rather than ResponseTimeoutException - Fix a bug where HttpSessionHandler.failPendingResponses() does not fail anything at all - Make TimeoutException traceless to reduce its instantiation overhead Result: - Robustness - Fixes potential issues when attempting to resolve a rejected promise. - Late responses are now silently discarded to avoid log message flooding
More robust resolution/rejection of a promise
@anuraaga Thanks for merging :-) |
Motivation:
When a client does not receive a response or a server fails to process a
request within time limit, an invocation promise is rejected regardless
the final outcome of the invocation.
In such a case, a ServiceInvocationHandler or a remote invoker
implementation might attempt to resolve or reject the promise which is
already rejected with TimeoutException. Handling this sort of situations
is very common, and thus we should provide it as part of Armeria.
Modifications:
provide a simple and robust way to resolve or reject a promise in a
ServiceInvocationHandler
ResponseTimeoutException
fail anything at all
Result:
flooding