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

Grpc exception handler: Modified to return BADREQUEST for some internal errors #4387

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

kkondaka
Copy link
Collaborator

@kkondaka kkondaka commented Apr 3, 2024

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

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • [ X] Commits are signed with a real name per the DCO

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.

@kkondaka kkondaka force-pushed the grpc-exception-handler branch from 6acf70e to 91e6379 Compare April 3, 2024 17:37
Copy link
Member

@dlvenable dlvenable left a 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"))) {
Copy link
Member

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Collaborator

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

@kkondaka kkondaka merged commit dc9f5a7 into opensearch-project:main Apr 9, 2024
45 of 47 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 9, 2024
…al errors (#4387)

Signed-off-by: Krishna Kondaka <[email protected]>
Co-authored-by: Krishna Kondaka <[email protected]>
(cherry picked from commit dc9f5a7)
dlvenable pushed a commit that referenced this pull request Apr 11, 2024
…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]>
@kkondaka kkondaka added this to the v2.8 milestone May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants