Skip to content

Conversation

@Anshul-creator
Copy link
Contributor

What is the purpose of the change?

This PR stabilizes the following tests in MethodConfigTest:

  • testOverrideMethodConfigOfService
  • testAddMethodConfigOfService
  • testOverrideMethodConfigOfReference
  • testAddMethodConfigOfReference
  • testIgnoreInvalidMethodConfigOfService

These tests were intermittently failing under randomized execution orders (NonDex) due to nondeterministic behavior in Micrometer’s composite meter registry. The tests focus on method-level configuration overrides and do not intend to validate metrics behavior. Yet, the metrics subsystem was being initialized as part of the bootstrap process, introducing unnecessary nondeterminism.

Root Cause

During application bootstrap, Dubbo initializes the metrics subsystem, which in turn configures Micrometer’s composite meter registry. Internally, Micrometer uses an IdentityHashMap whose iteration behavior is not deterministic under randomized JVM execution orders.

Under certain NonDex seeds, this produces:

java.lang.ArrayIndexOutOfBoundsException
  at java.util.IdentityHashMap$KeyIterator.next(...)
  at io.micrometer.core.instrument.composite.CompositeMeterRegistry.updateDescendants(...)

These failures occur before the tests exercise any method-configuration logic, so the flakiness is caused purely by nondeterministic metrics initialization and not by the MethodConfig functionality under test.

Changes Made

  • Added test-local configuration to explicitly disable the metrics subsystem for every test in MethodConfigTest.
  • Ensured isolation by calling SysProps.clear() in @BeforeEach and DubboBootstrap.reset() in @AfterEach, so no metrics/config-related state leaks across tests.
  • Kept all existing assertions and behavior intact.

Verification

You can try running the following snippet of code from the dubbo repo root, on both pre-fix and post-fix code

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

The tests should fail intermittently on the pre-fix version, but pass consistently across all seeds on the post-fix version.
NonDex run logs will be available under the dubbo-config/dubbo-config-api/.nondex directory.

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. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.67%. Comparing base (58d7386) to head (771fe6e).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #15782      +/-   ##
============================================
- Coverage     60.77%   59.67%   -1.10%     
+ Complexity    11706    11685      -21     
============================================
  Files          1938     1938              
  Lines         88646    88643       -3     
  Branches      13379    13379              
============================================
- Hits          53875    52899     -976     
- Misses        29249    30291    +1042     
+ Partials       5522     5453      -69     
Flag Coverage Δ
integration-tests-java21 32.45% <ø> (+0.09%) ⬆️
integration-tests-java8 32.49% <ø> (+0.05%) ⬆️
samples-tests-java21 32.10% <ø> (+0.12%) ⬆️
samples-tests-java8 29.72% <ø> (-0.02%) ⬇️
unit-tests-java11 ?
unit-tests-java17 ?
unit-tests-java21 ?
unit-tests-java25 ?
unit-tests-java8 59.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@songxiaosheng songxiaosheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zrlw zrlw self-requested a review November 20, 2025 07:52
Copy link
Contributor

@zrlw zrlw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

4 participants