Skip to content

fix(discov): refresh etcd client after publisher watch errors - #5709

Open
014-code wants to merge 3 commits into
zeromicro:masterfrom
014-code:fix/etcd-publisher-auth-recovery
Open

014-code wants to merge 3 commits into
zeromicro:masterfrom
014-code:fix/etcd-publisher-auth-recovery

Conversation

@014-code

@014-code 014-code commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #5707.

This PR prevents the etcd publisher from repeatedly reusing a stale cached client after watch/keepalive failures. When the publisher's keepalive channel closes or the watch stream returns an error, it now revokes the current lease and invalidates the cached etcd client before re-registering, allowing a fresh client with a valid auth token to be created.

It also adds single-resource removal support to syncx.ResourceManager, used by the discovery registry to invalidate one cached etcd connection without closing the whole manager.

Tests

Added tests:

  • TestResourceManager_RemoveResource
  • TestPublisher_keepAliveAsyncWatchErrorRefreshesClient

Passed:

  • go test ./core/discov/... -count=1
  • go test ./core/syncx -run TestResourceManager_RemoveResource -count=1

Note:

  • go test ./core/syncx -count=1 still fails on existing unrelated test TestImmutableResourceErrorRefreshAlways, expecting count 2 but got 1.

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Successfully merging this pull request may close these issues.

Bug: Etcd publisher spams logs and fails to recover after auth token expiry

1 participant