Skip to content

Conversation

@Anshul-creator
Copy link
Contributor

What is the purpose of the change?

This PR stabilizes a large set of tests across three Spring-related test classes inside dubbo-config-spring that were intermittently failing under randomized execution orders (NonDex) due to shared Dubbo/Spring framework state leaking across test boundaries. The following tests were consistently among the flaky failures before this fix, but now pass reliably across all NonDex seeds:

  • ConfigTest: testGenericServiceConfig, testSystemPropertyOverrideReferenceConfig, testServiceClass, testProviderNestedService, testSystemPropertyOverrideProtocol, test_noMethodInterface_methodsKeyHasValue, testInitReference, testDubboProtocolPortOverride, testAppendFilter, testSystemPropertyOverrideMultiProtocol, testMultiProtocol, testGenericServiceConfigThroughSpring

  • DubboNamespaceHandlerTest: testMetricsAggregation, testDelayFixedTime, testDefaultProtocol, testCustomParameter, testProviderXmlOnConfigurationClass, testProviderXml, testProperty, testNotificationWithWrongBean, testMonitor, testMultiProtocol, testTimeoutConfig, testModuleInfo

  • JavaConfigReferenceBeanTest: testGenericServiceAnnotationBean, testReferenceBean, testLazyProxy2, testAnnotationBean, testLazyProxy1, testGenericServiceReferenceBean, testAnnotationAtField, testLazyProxy3

Root Cause

These failures are identical to previously fixed issues in:

Each of those PRs addressed flakiness caused by Micrometer’s CompositeMeterRegistry, which can throw an ArrayIndexOutOfBoundsException when it iterates over internal IdentityHashMap structures under randomized execution orders (NonDex).

ConfigTest, DubboNamespaceHandlerTest, JavaConfigReferenceBeanTest suffered from the same underlying issue:
Dubbo framework state was leaking between test methods. This meant that the behavior of reference creation in one test could affect subsequent tests, causing nondeterministic failures.

Changes Made

To fully isolate each test method and eliminate shared state, the following changes were applied:

  • Disabled the metrics subsystem at the beginning of each test.
  • Cleared all system properties via SysProps.clear() in the lifecycle hooks to avoid cross-test pollution.
  • Reset framework state using DubboBootstrap.reset() to ensure isolation between tests.
  • In DubboNamespaceHandlerTest.testMetricsPrometheus(), metrics are explicitly re-enabled in a controlled and isolated way to test Prometheus behavior without leaking state into other tests.

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-spring \ edu.illinois:nondex-maven-plugin:2.2.1:nondex \ -DnondexRuns=50

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-spring/.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 Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.74%. Comparing base (04a620e) to head (9c0d64e).

Additional details and impacted files
@@ Coverage Diff @@ ## 3.3 #15819 +/- ## ============================================ - Coverage 60.77% 60.74% -0.03%  - Complexity 11693 11696 +3  ============================================ Files 1938 1938 Lines 88679 88679 Branches 13386 13386 ============================================ - Hits 53895 53871 -24  - Misses 29252 29273 +21  - Partials 5532 5535 +3 
Flag Coverage Δ
integration-tests-java21 32.36% <ø> (+0.05%) ⬆️
integration-tests-java8 32.44% <ø> (+<0.01%) ⬆️
samples-tests-java21 31.99% <ø> (+<0.01%) ⬆️
samples-tests-java8 29.61% <ø> (-0.05%) ⬇️
unit-tests-java11 59.07% <ø> (-0.01%) ⬇️
unit-tests-java17 58.55% <ø> (-0.01%) ⬇️
unit-tests-java21 58.55% <ø> (-0.02%) ⬇️
unit-tests-java25 58.50% <ø> (+<0.01%) ⬆️
unit-tests-java8 59.04% <ø> (-0.01%) ⬇️

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
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

3 participants