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

core: add description to Status.UNKNOWN in ServerImpl's #internalClose #10643

Merged
merged 5 commits into from
Nov 6, 2023

Conversation

sergiitk
Copy link
Member

@sergiitk sergiitk commented Nov 2, 2023

This is currently the only place where we return Status.UNKNOWN with no description, which makes is harder to debug and differentiate from statuses originated from non-grpc sources.

This PR enriches ServerImpl's #internalClose Status.UNKNOWN with description Application error processing RPC.

This is currently the only place where we return Status.UNKNOWN
with no description, which makes is harder to debug and differentiate
from statuses originated from non-grpc sources.

This PR enriches ServerImpl's #internalClose `Status.UNKNOWN` with
description `Internal Application Error` and appends context
information for the origin of the error; one of:

- ServerCallListener(app).messagesAvailable
- ServerCallListener(app).halfClosed
- ServerCallListener(app).onReady
// TODO(ejona86): this is not thread-safe :)
stream.close(Status.UNKNOWN.withCause(t), new Metadata());
String description = "Application Error @ task " + task;
Copy link
Member Author

Choose a reason for hiding this comment

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

Considered @ context instead of @ task. Let me know if you like one or another better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use "Application Error while processing " + message/half close/onReady. The trace task name is too internally oriented for a good user message.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ejona86 what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest "Application error", "Application error processing RPC", or such. We have logged for the service authors to investigate what is wrong, we try not to tell the client too much because it could be an attacker, and the strings here are probably misleading. For that last point, the problem is the stubs morph things; most RPCs that throw will be within "half close" because they are unary and that's the point we call the application. But few know that. Including that information seems likely to just steer someone in the wrong direction.

// TODO(ejona86): this is not thread-safe :)
stream.close(Status.UNKNOWN.withCause(t), new Metadata());
String description = "Application Error @ task " + task;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use "Application Error while processing " + message/half close/onReady. The trace task name is too internally oriented for a good user message.

@sergiitk sergiitk merged commit 8b4b14a into grpc:master Nov 6, 2023
6 checks passed
@sergiitk sergiitk deleted the internal-close-msg branch November 6, 2023 20:31
YifeiZhuang added a commit to YifeiZhuang/grpc-java that referenced this pull request Nov 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants