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

server: prevent hang in Go HTTP transport in some error cases #3833

Merged
merged 2 commits into from
Aug 22, 2020
Merged

server: prevent hang in Go HTTP transport in some error cases #3833

merged 2 commits into from
Aug 22, 2020

Conversation

GarrettGutierrez1
Copy link
Contributor

Fixes #3713

server.go Outdated
if e := t.WriteStatus(stream, st); e != nil {
channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status %v", e)
}
st, _ := status.FromError(err)
Copy link
Member

Choose a reason for hiding this comment

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

Let's use toRPCErr instead for this conversion.

Copy link
Member

Choose a reason for hiding this comment

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

Oh no.. maybe not. That doesn't guarantee a status is returned. It can return io.EOF. It is nicer than status.FromError in that it handles other types of errors, though.

Copy link
Member

Choose a reason for hiding this comment

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

OK, this is good enough, then, since we don't expect it to not be a status in most cases. But please use status.Convert instead and remove the st variable.

@dfawley dfawley changed the title Return codes.Unknown with unknown error status on processUnaryRPC server: prevent hang in Go HTTP transport in some error cases Aug 21, 2020
@GarrettGutierrez1 GarrettGutierrez1 merged commit 0e72e09 into grpc:master Aug 22, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
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.

Hang caused by certain errors in processUnaryRPC
2 participants