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

*: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled #7759

Merged
merged 1 commit into from
Apr 19, 2017

Conversation

mitake
Copy link
Contributor

@mitake mitake commented Apr 18, 2017

if err == ctx.Err() && ctx.Err() != c.ctx.Err() {
err = grpc.ErrClientConnTimeout

err := c.getToken(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could auth return a bogus token from server side instead of expecting the client to know if auth is enabled or not? When auth is turned on the server will reject it and the client will renegotiate. That'll avoid having this extra error handling path.

Copy link
Contributor

@heyitsanthony heyitsanthony Apr 18, 2017

Choose a reason for hiding this comment

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

On the other hand, the server probably shouldn't fake it. Never mind.


err := c.getToken(ctx)
if err != nil {
if err.Error() != rpctypes.ErrAuthNotEnabled.Error() {
Copy link
Contributor

Choose a reason for hiding this comment

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

toErr(ctx, err) != rpctypes.ErrAuthNotEnabled

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, I'll modify this line.

@mitake
Copy link
Contributor Author

mitake commented Apr 19, 2017

@heyitsanthony updated based on your comment, could you take a look?

@heyitsanthony
Copy link
Contributor

lgtm. One question: will the client retry and authenticate if auth is enabled some time after hitting this path?


err := c.getToken(ctx)
if err != nil {
if toErr(ctx, err).Error() != rpctypes.ErrAuthNotEnabled.Error() {
Copy link
Contributor

Choose a reason for hiding this comment

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

wait, why does this still need Error()? the pointer comparison should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah sorry, they must be needless. I'll remove the both Error() calls

@mitake
Copy link
Contributor Author

mitake commented Apr 19, 2017

Current implementation of clientv3 won't retry. Because it only retries when the error code is ErrInvalidAuthToken. In the case of enabling auth after Authenticate(), user name and revision in the request header will be empty and 0. So the returned error code will be ErrUserEmpty. The client will simply propagate the error to its caller.

Possibly adding a new test case will be helpful. Should I add it in this PR? I think this is an independent topic so would like to do it in another PR if it is ok.

@heyitsanthony
Copy link
Contributor

@mitake OK, sure, file an issue for the disable/enable case after merging this one so it doesn't get lost in the shuffle?

Also remove ctlV3PutFailAuthDisabled so CI stops complaining? Thanks!

@mitake
Copy link
Contributor Author

mitake commented Apr 19, 2017

@heyitsanthony sure, I'll remove the unused func and open the issue. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants