Skip to content

Auth token is not automatically refreshed, long-living client connections are unauthenticated after TTL expires #34

Description

@whilenot-dev

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:

  1. configure your etcd cluster with a short auth-ttl
  2. create and connect a client with aetcd
  3. await TTL (calls made before the TTL expires will extend the TTL!)
  4. 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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions