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

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

Open
whilenot-dev opened this issue Jan 8, 2025 · 2 comments

Comments

@whilenot-dev
Copy link

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.

@martyanov
Copy link
Owner

@whilenot-dev Many thanks for reporting the issue!

I'm currently out of business, IT industry in its current shape is a mess I have no desire to deal with.

Since I left the company that was using the driver its future is undefined.

I'm sorry about that!

@whilenot-dev
Copy link
Author

whilenot-dev commented Jan 8, 2025

Thanks for the quick reply @martyanov, nothing to be sorry about!

Seems like I'll have a future PR to contribute then =)

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

No branches or pull requests

2 participants