[Bug]: Expired etcd worker lease is reported as refreshed and blocks re-registration
Summary and impact
After an etcd-backed worker registration lease expires, Etcd3ClusterStorage.expire() returns True even though the key remains absent. The worker's heartbeat consequently advances its local registration-expiry timestamp and keeps running without restoring registration. An explicit re-registration through the same storage object also fails because its cached lease is already dead.
This is a recovery/availability problem: a live worker can remain missing from service discovery after a temporary worker stall or lease loss. I reproduced the registration/heartbeat behavior against a real local etcd server; I have not measured model-serving traffic or GPU effects.
System info and validation boundary
- Upstream
maincommit:3163e66b2c5b8e5de2995f87dafb06ef62148446. - Client host: Windows, Python 3.10.11; server: Linux Docker,
quay.io/coreos/etcd:v3.5.21. etcd-sdk-python==0.0.7(the repository pin),grpcio==1.84.0,protobuf==6.33.6(within repository constraints).- CPU-only component run. The full unchanged upstream
cluster_storage.pyanddisagg_auto_scaling.pymodules were loaded withimportlib; package namespaces bypassed TensorRT/native bootstrap. The config dataclasses and role enum were taken unchanged from the same source to avoid their unrelated native dependency chain. I/O used the real pinned etcd SDK and a real etcd process; no fake lease responses or modified production methods. - The normal full-package import/GPU stack was not exercised locally. The snippet below uses normal production imports for reproduction in a matching TensorRT-LLM environment.
Minimal reproduction
Start a dedicated etcd 3.5 server listening on 127.0.0.1:2379, then run:
import asyncio
import uuid
import grpc
from tensorrt_llm.serve.cluster_storage import Etcd3ClusterStorage
async def main():
endpoint = "etcd://127.0.0.1:2379" # dedicated local etcd
storage = Etcd3ClusterStorage(endpoint, "repro")
fresh = Etcd3ClusterStorage(endpoint, "repro")
key = "/trtllm-lease-repro/" + uuid.uuid4().hex
try:
assert await storage.set(key, "alive", ttl=2)
assert await storage.expire(key, ttl=2)
assert await storage.get(key) == "alive" # live-lease control
deadline = asyncio.get_running_loop().time() + 15
while await storage.get(key) is not None:
assert asyncio.get_running_loop().time() < deadline
await asyncio.sleep(0.1)
print("refresh expired:", await storage.expire(key, ttl=2))
print("key after refresh:", await storage.get(key))
for attempt in range(3):
try:
print("retry:", await storage.set(
key, "recovered", overwrite_if_exists=True, ttl=2))
except grpc.RpcError as error:
print("retry error:", error.code(), error.details())
print("fresh object:", await fresh.set(
key, "recovered", overwrite_if_exists=True, ttl=2))
print("fresh value:", await fresh.get(key))
finally:
await fresh.delete(key)
storage.client.close()
fresh.client.close()
asyncio.run(main())
Actual behavior
All three independent component runs produced:
refresh expired: True
key after refresh: None
retry error: StatusCode.NOT_FOUND etcdserver: requested lease not found
retry error: StatusCode.NOT_FOUND etcdserver: requested lease not found
retry error: StatusCode.NOT_FOUND etcdserver: requested lease not found
fresh object: True
fresh value: recovered
The raw SDK keepalive response for the expired lease has TTL=0. The original storage object retains the same lease ID across all failed retries; the fresh object creates a different lease and succeeds.
I also exercised the unchanged DisaggClusterWorker background heartbeat with heartbeat_interval_sec=1, inactive_timeout_sec=2. After a four-second simulated worker-event-loop stall, real etcd removed the registration. Across three completed heartbeat refreshes after resumption, the heartbeat task stayed running and the worker moved its claimed expiry into the future, while the key remained absent each time. Thus the issue is observable through the real worker logic, not only a standalone storage API call.
Expected behavior
An expired/missing lease must not be reported as a successful TTL refresh. Recovery should invalidate the dead cached lease and obtain a usable lease before registration is restored. A healthy resumed worker should either regain a visible registration or expose an explicit recovery failure, rather than continue apparently successful heartbeats for an absent key.
Relevant paths / possible direction
Etcd3ClusterStorage.expireconsumes the keepalive response but returnsTruewithout inspecting its TTL/result._get_leaseretains leases by key; registration retries reuse the expired lease.DisaggClusterWorker._refresh_registrationtrusts the successful refresh and stamps a new local expiry._heartbeatre-registers only when refresh returns false.
A focused fix could validate the keepalive response and invalidate/recreate cached leases on expiry or lease-not-found, with real-etcd and CPU regression coverage. The intended recovery policy should be confirmed before implementation.
I searched issues and PRs for etcd lease, lease not found, etcd heartbeat, and cached lease. I found the original etcd implementation (#8210) and unrelated/annotation work, but no matching recovery report or fix.