You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Nested configuration properties ignore OVERRIDE_IF_ABSENT during refresh #16513
Searched existing issues and pull requests for the same problem.
Apache Dubbo component
Java SDK (apache/dubbo)
Version
Branch: 3.3
Version: 3.3.7-SNAPSHOT
Base commit: ae809de2fc81b408194240965eb20bf27e6971df
Reproduced on Windows 11 with Eclipse Temurin JDK 17.0.20.1 and Maven 3.9.14.
Steps to reproduce
Set dubbo.config.mode=OVERRIDE_IF_ABSENT before creating the application model.
Create a MetricsConfig with enableJvm=true and an AggregationConfig with enabled=false and bucketNum=5.
Add external properties dubbo.metrics.enable-jvm=false, dubbo.metrics.aggregation.enabled=true, dubbo.metrics.aggregation.bucket-num=10, and dubbo.metrics.aggregation.time-window-seconds=120.
Call MetricsConfig.refresh().
Expected behavior
The configured values are retained: enableJvm=true, aggregation.enabled=false, and aggregation.bucketNum=5. The absent aggregation.timeWindowSeconds is populated with 120.
Actual behavior
The top-level enableJvm=true is retained, but the nested values are replaced with aggregation.enabled=true and aggregation.bucketNum=10. The same problem occurs with a second nesting level, such as prometheus.exporter.enabled.
Root cause
AbstractConfig.assignProperties() creates a new nested object on every refresh, discarding the nested instance whose values should be checked. In addition, isPropertySet() invokes the nested property's getter against the outer AbstractConfig instance. The resulting reflection exception is ignored and the property is treated as absent.
Regression evidence
The added MetricsConfigRefreshTest contains nine parameterized cases covering existing nested values, deeply nested values, and missing nested instances under STRICT, OVERRIDE_ALL, and OVERRIDE_IF_ABSENT.
Before the production fix: nine cases run, two assertion failures, zero errors, zero skipped. Both failures occur under OVERRIDE_IF_ABSENT, where false becomes true. With the fix, all nine pass.
The test restores the previous configuration-mode system property and destroys its framework model after each case.
Are you willing to submit a pull request to fix this?
Activity