Skip to content

Conversation

vimanikag
Copy link
Contributor

@vimanikag vimanikag commented Sep 15, 2025

Fixes : #11246

@vimanikag vimanikag changed the title 11246 :: Unexpected error when server expands a compressed message to learn it is too large 11246 :: Unexpected error when server expands a compressed message to learn it is too large Sep 15, 2025
Comment on lines 816 to 820
if (t instanceof StatusRuntimeException) {
if (((StatusRuntimeException) t).getStatus().getCode() == Status.Code.RESOURCE_EXHAUSTED) {
statusToPropagate = ((StatusRuntimeException) t).getStatus().withCause(t);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be refactored to use a single if. But, personally I would extract out the explicit conversion of t into a variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, @AgraVator . I've addressed the comments.

ServerStreamListener mockListener = mock(ServerStreamListener.class);
listener.setListener(mockListener);

RuntimeException expectedT = new RuntimeException();
Copy link
Contributor

Choose a reason for hiding this comment

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

expectedT ?

Copy link
Contributor Author

@vimanikag vimanikag Oct 7, 2025

Choose a reason for hiding this comment

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

@AgraVator , The new test cases are inspired by the existing junit's like onReady_runtimeExceptionCancelsCall()/halfClosed_runtimeExceptionCancelsCall , following the same naming format. Please advise if you would prefer to change the variable to expected if We suspect it's a typo or if the current naming was intentional.

Comment on lines 817 to 818
if (((StatusRuntimeException) t).getStatus().getCode() == Status.Code.RESOURCE_EXHAUSTED) {
statusToPropagate = ((StatusRuntimeException) t).getStatus().withCause(t);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there no other cases where we can get "RESOURCE_EXHAUSTED" ? As, this is not tied specifically to marshaling the intended behavior can change if and when new "RESOURCE_EXHAUSTED" are added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AgraVator , I've addressed the review comments and changed the logic to handle both StatusRuntimeException and StatusException , I also maintained the existing exception propagation as same for other status code except RESOURCE_EXHAUSTED, Please review and share your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected error when server expands a compressed message to learn it is too large
2 participants