-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
auth: Use async version of getRequestMetadata #3758
Conversation
e8ce453
to
ef49437
Compare
try { | ||
lastHeaders = toHeaders(metadata); | ||
} catch (Throwable t) { | ||
applier.fail(Status.UNAUTHENTICATED.withCause(t)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you put try-catch outside of synchronized, you should be able to call applier.fail() without holding the lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
firstNonNull(callOptions.getExecutor(), appExecutor), applier); | ||
try { | ||
creds.applyRequestMetadata(method, effectiveAttrsBuilder.build(), | ||
firstNonNull(callOptions.getExecutor(), appExecutor), applier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applyRequestMetadata() is not supposed to throw. Errors should be passed to the applier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is user-provided code, I don't feel like that negates the need to handle exceptions from the call. It's too easy for a NPE or similar to leak through. I've adding a message to the status to make it clearer the code did something wrong.
I'm going to need to rebase on top of #3757. When I do that I'll also update the Statuses to make sure they descriptions. |
This avoids using DelayedStream and a thread hop when the credentials are known immediately.
This avoids using DelayedStream and a thread hop when the credentials
are known immediately.
This is dependent on #3757.