Skip to content

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

@Anshul-creator

Description

@Anshul-creator

Pre-check

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

Search before asking

  • 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 #15795 which have all been accepted. The PR's opened for this issue are as follows:

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

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

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions