xzyJavaX opened a new issue, #11140:
URL: https://github.com/apache/skywalking/issues/11140

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   Java Agent (apache/skywalking-java)
   
   ### What happened
   
   When registering `AgentConfigChangeWatcher` in dynamic configuration, there 
may be different `AgentConfigChangeWatchers` using the same `propertyKey`. 
Although there are currently no such cases in `skywalking-java`, but this 
situation should have been taken into consideration in the previous design. For 
example:
   ```
   private final Map<String, List<WatcherHolder>> register = new HashMap<>();
   ```
   The same key can correspond to multiple ` WatcherHolders` .
   There is a logic in 
`org.apache.skywalking.apm.agent.core.conf.dynamic.ConfigurationDiscoveryService#getAgentDynamicConfig()`:
    ```        
    // Some plugin will register watcher later.
   final int size = register.keys().size();
    if (lastRegisterWatcherSize != size) {
           // reset uuid, avoid the same uuid causing the configuration not to 
be updated.
           uuid = null;
           lastRegisterWatcherSize = size;
   }
    ```       
   The situation where the number of keys remains unchanged, but the number of 
` WatcherHolders`  corresponding to keys increases, was not considered here. If 
some plugins will register watchers later, but the keys they use are the same 
as those in the previous register, then the uuid will not be reset and these 
configurations will not be updated.
   
   ### What you expected to happen
   
   No response
   
   ### How to reproduce
   
   No response
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

Reply via email to