bajiaoshan opened a new issue, #16513:
URL: https://github.com/apache/dubbo/issues/16513

   ### Pre-check
   
   - [x] All content is in English.
   - [x] 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
   
   1. Set `dubbo.config.mode=OVERRIDE_IF_ABSENT` before creating the 
application model.
   2. Create a `MetricsConfig` with `enableJvm=true` and an `AggregationConfig` 
with `enabled=false` and `bucketNum=5`.
   3. 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`.
   4. 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?
   
   Yes, a fix and regression tests are ready.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to