Fix metadata retries blocking provider instance updates by hehuang139 · Pull Request #16522 · apache/dubbo · GitHub
Skip to content

Fix metadata retries blocking provider instance updates - #16522

Open
hehuang139 wants to merge 2 commits into
apache:3.3from
hehuang139:codex/fix-16149-metadata-events
Open

hehuang139 wants to merge 2 commits into
apache:3.3from
hehuang139:codex/fix-16149-metadata-events

Conversation

@hehuang139

@hehuang139 hehuang139 commented Oct 19, 2026 •

Copy link
Copy Markdown

What is the purpose of the change?

Fixes #16149.

A metadata retry holds the instance listener monitor while fetching metadata from providers. If that request stalls, registry callbacks cannot update the provider list and subsequent retries continue using obsolete instances.

Update instance lists under a short synchronized section and let one refresh processor retrieve metadata from a snapshot. Notifications received during retrieval update the latest snapshot and return; obsolete results are discarded before address publication. Pending changes are also processed after a retrieval failure. Destroyed listeners reject late results and release queued instance events, including when destruction races with the next refresh iteration.

Validation on Linux with JDK 17 and Maven 3.9.9:

  • Reproduced the issue before the fix: a provider-change callback timed out while a retry metadata fetch was paused.
  • Passed 39 tests covering concurrent provider changes, obsolete snapshots with multiple revisions, repeated notification failures, event acceptance, destruction, existing listeners with both empty-protection settings, and service discovery registry behavior.
  • Passed module spotless:check and git diff --check.

The test command was:

mvn -B -ntp -pl dubbo-registry/dubbo-registry-api -am test jacoco:report -Dtest=ServiceInstancesChangedListenerConcurrencyTest,ServiceInstancesChangedListenerTest,ServiceInstancesChangedListenerWithoutEmptyProtectTest,ServiceDiscoveryRegistryTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Pjacoco,skip-spotless -Dcheckstyle.skip=true -Drat.skip=true

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction.
  • Make sure GitHub Actions can pass.

@codecov-commenter

codecov-commenter commented Oct 19, 2026 •

Copy link
Copy Markdown

@hehuang139

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
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] a dead-lock case in ServiceInstanceChangeListener will cause consumer can`t use latest provider instances list

2 participants