dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] Metrics Initialization Causing Flaky Tests in `dubbo-config/dubbo-config-api`

Open Anshul-creator opened this issue 2 weeks ago • 2 comments

Pre-check

  • [x] I am sure that all the content I provide is in English.

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo 3.3.7 JDK 17/21

Steps to reproduce this issue

Several tests across dubbo-config/dubbo-config-spring exhibit flaky behavior when execution order or JVM internal iteration order changes. These flakes were consistently reproduced using:

./mvnw -q -pl dubbo-config/dubbo-config-spring\
  edu.illinois:nondex-maven-plugin:2.2.1:nondex \
  -DnondexRuns=50

The reasons for the flakiness are below:

Micrometer metrics subsystem initialization

  • CompositeMeterRegistry uses mutable global structures
  • IdentityHashMap iteration order varies
  • Metrics are initialized implicitly during DubboBootstrap.start()

DubboBootstrap global state not reset across tests

  • ApplicationModel / FrameworkModel carry over state
  • Reference cache survives between tests
  • System properties affect bootstrap behavior if not cleared

What you expected to happen

All tests should pass deterministically and be independent of JVM iteration order or test execution order.

Anything else

I have opened several PR's for solving the issue. The PR structure follows the PR's I had opened for https://github.com/apache/dubbo/issues/15795 which have all been accepted. The PR's opened for this issue are as follows:

  • https://github.com/apache/dubbo/pull/15819
  • https://github.com/apache/dubbo/pull/15828
  • https://github.com/apache/dubbo/pull/15833
  • https://github.com/apache/dubbo/pull/15834
  • https://github.com/apache/dubbo/pull/15835
  • https://github.com/apache/dubbo/pull/15840
  • https://github.com/apache/dubbo/pull/15841
  • https://github.com/apache/dubbo/pull/15844
  • https://github.com/apache/dubbo/pull/15845
  • https://github.com/apache/dubbo/pull/15846

Are you willing to submit a pull request to fix on your own?

  • [x] Yes I am willing to submit a pull request on my own!

Code of Conduct

Anshul-creator avatar Dec 12 '25 01:12 Anshul-creator

@RainYuY @zrlw please review the issue and corresponding PR's

Anshul-creator avatar Dec 12 '25 18:12 Anshul-creator

please merge into one pr,there are too many prs so that can't review. @Anshul-creator

heliang666s avatar Dec 15 '25 16:12 heliang666s

please merge into one pr,there are too many prs so that can't review. @Anshul-creator

Yes, I agree. It's a little hard for me to review each PR.

RainYuY avatar Dec 17 '25 08:12 RainYuY

I decided to split the fixes across multiple PRs because the changes span multiple sub-modules and touch a large number of files. A single PR would likely involve ~40–50 files across different areas, which would be harder to review and reason about.

Each PR is scoped to stabilize failing tests within a specific sub-module of dubbo-config/dubbo-config-spring (for example, https://github.com/apache/dubbo/pull/15828 focuses only on the reference sub-module). This keeps each change set focused, easier to review, and easier to revert if needed. Moreover, the PRs are independent and do not depend on ordering or shared changes.

Anshul-creator avatar Dec 17 '25 22:12 Anshul-creator

"Hi @chickenlj, I am Cornellius Limo (LI123456mo). I just joined the mailing list. I am currently learning Java and Spring Boot. I would like to help with this issue to get familiar with the codebase. Could you point me to a specific test file in dubbo-config-spring that still needs stabilization?"

LI123456mo avatar Dec 23 '25 19:12 LI123456mo