-
Notifications
You must be signed in to change notification settings - Fork 207
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
Grpc exception handler: Modified to return BADREQUEST for some internal errors #4387
Grpc exception handler: Modified to return BADREQUEST for some internal errors #4387
Conversation
…al errors Signed-off-by: Krishna Kondaka <[email protected]>
6acf70e
to
91e6379
Compare
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.
Is this resolving #4022?
@@ -60,6 +63,9 @@ private Status handleExceptions(final Throwable e) { | |||
} else if (e instanceof BadRequestException) { | |||
badRequestsCounter.increment(); | |||
return createStatus(e, Status.INVALID_ARGUMENT); | |||
} else if ((e instanceof StatusRuntimeException) && (message.contains("Invalid protobuf byte sequence") || message.contains("Can't decode compressed frame"))) { |
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.
Is there anything else here that we can use other than a string? This seems like a brittle check.
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 couldn't think of any other way because getCause() is null
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.
Also, grpc getStatus() on grpc StatusRuntimeException is just showing the error as INTERNAL. I do not see any other option here.
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.
@kkondaka , I think this can work for now. Which project is creating this exception - Armeria or gRPC? I think we should reach out to them and let them know that there is not enough information to handle this error as we'd like without relying on user error messages, which can be brittle.
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.
Note, that I am migrating the GrpcRequestExceptionHandler to implement GoogleGrpcExceptionHandlerFunction
. This also changes this method slightly. But it will most likely not help with this problem: https://github.com/opensearch-project/data-prepper/pull/4294/files
…al errors (#4387) Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> (cherry picked from commit dc9f5a7)
…al errors (#4387) (#4405) Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> (cherry picked from commit dc9f5a7) Co-authored-by: Krishna Kondaka <[email protected]>
Description
Grpc exception handler: Modified to return BADREQUEST for some internal errors.
Internal errors related to compression mismatch between sender and receiver and sent as BADREQUEST
Issues Resolved
Resolves #4022
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.