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

v3electionpb.proto Campaign return "invalid auth token" when the token has been deleted #11381

Closed
cnjinshuai opened this issue Nov 22, 2019 · 1 comment
Labels

Comments

@cnjinshuai
Copy link

v3electionpb.proto Campaign return "invalid auth token" when setcd server has been deleted token.

etcdserver/api/v3electionpb/v3electionpb.proto
rpc Campaign(CampaignRequest) returns (CampaignResponse) {
option (google.api.http) = {
post: "/v3/election/campaign"
body: "*"
};
}

  1. Etcdserver auth enable.

  2. Two processes(A and B) call Campaign, A is leadership, B process blocks at Campaign-->waitDeletes->waitDelete-watch.

  3. After 5 mintues, auth token is deleted on etcdserver, A process call Resign rpc, B process watched delete event, then waitDeletes run

func waitDeletes(ctx context.Context, client *v3.Client, pfx string, maxCreateRev int64) (*pb.ResponseHeader, error) {
	getOpts := append(v3.WithLastCreate(), v3.WithMaxCreateRev(maxCreateRev))
	for {

> 		resp, err := client.Get(ctx, pfx, getOpts...)

		if err != nil {
			return nil, err
		}
		if len(resp.Kvs) == 0 {
			return resp.Header, nil
		}
		lastKey := string(resp.Kvs[0].Key)
		if err = waitDelete(ctx, client, lastKey, resp.Header.Revision); err != nil {
			return nil, err
		}
	}
}

return err_code: 2, error: etcdserver: invalid auth token.

etcdserver.EtcdServer's kv client is not RetryKVClient, so etcdserver.EtcdServer.KV.Get doesn't
authenticate by the old token.

how to make etcdserver.EtcdServer.KV.Get whithout authenticate.

@stale
Copy link

stale bot commented Apr 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

1 participant