[Bug] Metrics Initialization Causing Flaky Tests in `dubbo-config/dubbo-config-api`
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
CompositeMeterRegistryuses mutable global structuresIdentityHashMapiteration 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
- [x] I agree to follow this project's Code of Conduct
@RainYuY @zrlw please review the issue and corresponding PR's
please merge into one pr,there are too many prs so that can't review. @Anshul-creator
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.
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.
"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?"