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

How to avoid infinite retry after PerRPCCredentials.GetRequestMetadata returns non-nil error #3749

Closed
jschwinger233 opened this issue Jul 19, 2020 · 1 comment

Comments

@jschwinger233
Copy link

jschwinger233 commented Jul 19, 2020

background:

grpc server already implemented auth token

what I want:

refresh auth token every time a RPC gets called

how I tried to work it out:

make an another grpc call to fetch auth token in PerRPCCredentials.GetRequestMetadata; grpc guarantees PerRPCCredentials.GetRequestMetadata gets called for each RPC

what's the problem

imagine I make a stream grpc call and my client was configured wrong password to fetch auth token, in this case PerRPCCredentials.GetRequestMetadata returns non-nil forever, but what's out of my expectation is I stuck at creating grpc.ClientStream in the infinite retry loop: https://github.com/grpc/grpc-go/blob/master/stream.go#L598-L626

I could make stream fail fast but I don't want, because infinite retry on a stream, like a watch operation, makes sense, but only if the error is transient, and I don't think authentication failure is transient;

I was wondering if grpc.(*clientStream)shouldRetry can do the job to distinguish transient errors from the in-transient ones but the method always returns nil in the first condition: if cs.attempt.s == nil && !cs.callInfo.failFast { return nil }

would please offer some insights for this issue, thanks!

@menghanl
Copy link
Contributor

menghanl commented Jul 20, 2020

This issue was fixed by #3677. Please give it a try.

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

No branches or pull requests

2 participants