Repository navigation
fix(BA-9010): refresh the etcd auth token when it expires - #16940
Conversation
etcd drops an authentication token that has not been used for `--auth-token-ttl` (300 seconds by default). `AsyncEtcd` authenticated once at connect and kept sending that token, so requests started failing with `etcdserver: invalid auth token` a few minutes after start and were not retried. Turn on `ConnectOptions.with_auto_token_refresh()` (etcd-client-py 0.6.1) whenever a user is configured: a request rejected with an expired token authenticates again and is resent once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lablup-octodog
left a comment
There was a problem hiding this comment.
Summary
AsyncEtcd kept sending the etcd auth token it obtained at connect time, so requests failed with invalid auth token once the token TTL passed; this turns on automatic token refresh and bumps etcd-client-py to 0.6.1. The linked issue BA-9010 (etcd auth token expiry) could not be found. python.lock still resolves 0.6.0, so CI fails at dependency resolution.
Findings
Should fix
requirements.txt:141:python.lockstill pins etcd-client-py 0.6.0 with the specifier~=0.6.0, so every CI job that resolves the venv fails with the new requirement.src/ai/backend/common/etcd.py:372: No test asserts the auto-refresh option, so a change that drops this call still passes the suite.
Checks
7 of 34 checks failed and 2 are still running. The unit, scenario, and test-unit-gate jobs all end with The virtual environment has etcd-client-py 0.6.0 installed but it does not meet top level requirement etcd-client-py~=0.6.1, so the requirements.txt change without a python.lock update causes them. typecheck and scenario (1/6) are in progress.
Coverage
Read both changed files at the reviewed commit 73e80c4. Checked the original etcd.py, common/lock.py, python.lock, and parts of the etcd tests in the base checkout. The branch head has since advanced to c00009a, which adds changes/16940.fix.md.
Update only the etcd-client-py entry; a full regeneration also upgrades unrelated packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
--auth-token-ttl(300 seconds by default).AsyncEtcdauthenticated once at connect and kept sending that token for the life of the process, so requests failed withetcdserver: invalid auth tokena few minutes after start._should_retrydoes not retry it, so a manager GQL request that readsmanager/statusfrom etcd returned 500.ConnectOptions.with_auto_token_refresh(True)whenever a user is configured. A request rejected with an expired token authenticates again with the same user and is resent once.common/lock.pybuilds its lock client from the sameAsyncEtcd.etcd, so it gets the option too.etcd-client-pyto~=0.6.1, the first release with the option (feat: Add ConnectOptions.with_auto_token_refresh() etcd-client-py#21).Observed on the staging
lateststack (26.10.0a6, etcd 3.5.17), repeating every few minutes on two managers and a storage-proxy:Why refresh on the client
etcd expects a client to authenticate again when its token is rejected. The official clients do it by default; the Rust client leaves it off:
invalid auth tokenclientv3(etcd v3.5.17)client/v3/retry_interceptor.go: the default call option isretryAuth: true;shouldRefreshTokenmatchesErrInvalidAuthTokenandErrAuthOldRevision, thenrefreshToken()authenticates again and the call is retriedjetcdjetcd-core/.../impl/AuthCredential.javarefreshes the token when an RPC fails withinvalid auth tokenetcd-client0.21.1 (underetcd-client-py)ConnectOptions::with_auto_token_refresh(true), off by defaultsrc/caller.rsdo_call; the option clones every request so it can be resentThis change makes
AsyncEtcdbehave like the official clients.Test plan
lateststack and confirminvalid auth tokenno longer appearsResolves BA-9010
🤖 Generated with Claude Code