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

[grpc-proxy] token expires, the new watch does not refresh the token. #16112

Closed
4 tasks
JKeita opened this issue Jun 20, 2023 · 3 comments
Closed
4 tasks

[grpc-proxy] token expires, the new watch does not refresh the token. #16112

JKeita opened this issue Jun 20, 2023 · 3 comments
Labels

Comments

@JKeita
Copy link

JKeita commented Jun 20, 2023

Bug report criteria

What happened?

When a token expires, creating a new watch will cause all other watches to become invalid.

What did you expect to happen?

Creating a watch and waiting for the token to expire after 10 seconds, and then creating another watch will cause all watches to become invalid.

How can we reproduce it (as minimally and precisely as possible)?

start etcd:
./etcd --listen-peer-urls http://0.0.0.0:2380 --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --auth-token-ttl 10

start grpc-proxy:
./etcd grpc-proxy start --endpoints=0.0.0.0:2379 --listen-addr=0.0.0.0:23790

test example:
`
package main

import (
"context"
"fmt"
clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc"
"time"
)

func main() {
cli, _ := clientv3.New(clientv3.Config{
Endpoints: []string{"centos7:23790"},
DialTimeout: time.Second * 5,
DialOptions: []grpc.DialOption{grpc.WithBlock()},
})
fmt.Println("start")
ctx, _ := context.WithCancel(context.Background())
ch := cli.Watch(ctx, "/key")
for resp := range ch {
if resp.Err() != nil {
fmt.Println(resp.Err())
}
for _, e := range resp.Events {
k, v := e.Kv.Key, e.Kv.Value
fmt.Println(k, v)
}
}
}

`

Anything else we need to know?

No response

Etcd version (please run commands below)

$ etcd --version
# paste output here
etcd Version: 3.5.4
Git SHA: 08407ff76
Go Version: go1.16.15
Go OS/Arch: linux/amd64

$ etcdctl version
# paste output here
etcdctl version: 3.5.4
API version: 3.5

Etcd configuration (command line flags or environment variables)

paste your configuration here

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

$ etcdctl member list -w table
# paste output here

$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here

Relevant log output

No response

@CaojiamingAlan
Copy link
Contributor

Please see #12385 and #14995.

I think currently you can fix this by the way mentioned in #14995: create a new client each time before watching.

@jmhbnz
Copy link
Member

jmhbnz commented May 9, 2024

Discussed during sig-etcd triage meeting. @ahrtr is this a valid bug or should we close it given we have a workaround of opening new client before watch?

@ahrtr
Copy link
Member

ahrtr commented May 9, 2024

Duplicated to #15058

@ahrtr ahrtr closed this as completed May 9, 2024
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

4 participants