Skip to content

[Bug] The uuid was not reset, which caused the dynamic configuration to not be updated #11140

@xzyJavaX

Description

@xzyJavaX

Search before asking

  • I had searched in the issues 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?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentLanguage agent related.bugSomething isn't working and you are sure it's a bug!discussionDiscussionsjavaJava agent related

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions