My goal was to have a single, long-lived etcd client for a web service.
According to etcd issues it would be up to client SDKs to implement auth token renewal on long-lived connections. aetcd currently doesn't do a token refresh and I got to experience that the hard way.
To reproduce:
- configure your etcd cluster with a short
auth-ttl
- create and connect a client with aetcd
- await TTL (calls made before the TTL expires will extend the TTL!)
- make another call with the same client and the same connection ->
aetcd.exceptions.UnauthenticatedError: etcdserver: invalid auth token
key = '/foo'.encode()
ttl = 60
etcd = aetcd.Client()
await etcd.connect()
value = await etcd.get(key) # ok
await asyncio.sleep(ttl + 1)
value = await etcd.get(key) # error
As a workaround just use short-lived client connections wherever possible, á la:
async with aetcd.Client() as etcd:
# do stuff
I currently don't know if watchers are affected.
My goal was to have a single, long-lived etcd client for a web service.
According to etcd issues it would be up to client SDKs to implement auth token renewal on long-lived connections. aetcd currently doesn't do a token refresh and I got to experience that the hard way.
To reproduce:
auth-ttlaetcd.exceptions.UnauthenticatedError: etcdserver: invalid auth tokenAs a workaround just use short-lived client connections wherever possible, á la:
I currently don't know if watchers are affected.