You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2024/12/26 10:08:10 UTC

(skywalking) branch master updated: Add protection for dynamic config change propagate chain. (#12899)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 66201c9253 Add protection for dynamic config change propagate chain. (#12899)
66201c9253 is described below

commit 66201c92538dd2e1000d30a3a923b4c1c044e00e
Author: weixiang1862 <65...@qq.com>
AuthorDate: Thu Dec 26 18:08:05 2024 +0800

    Add protection for dynamic config change propagate chain. (#12899)
---
 docs/en/changes/changes.md                         |  1 +
 .../configuration/api/ConfigWatcherRegister.java   | 26 ++++++++++++++++------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index e388573df8..f17f89c883 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -37,6 +37,7 @@
 * BanyanDB: Support `@EnableSort` on the column to enable sorting for `IndexRule` and set the default to false.
 * Support `Get Effective TTL Configurations` API.
 * Fix `ServerStatusService.statusWatchers` concurrent modification.
+* Add protection for dynamic config change propagate chain.
 
 #### UI
 
diff --git a/oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java b/oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java
index 11e7748d11..36d37e7f9e 100644
--- a/oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java
+++ b/oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java
@@ -37,17 +37,25 @@ public abstract class ConfigWatcherRegister implements DynamicConfigurationServi
         if (newItemValue == null) {
             if (watcher.value() != null) {
                 // Notify watcher, the new value is null with delete event type.
-                watcher.notify(
-                    new ConfigChangeWatcher.ConfigChangeEvent(null, ConfigChangeWatcher.EventType.DELETE));
+                try {
+                    watcher.notify(
+                        new ConfigChangeWatcher.ConfigChangeEvent(null, ConfigChangeWatcher.EventType.DELETE));
+                } catch (Exception e) {
+                    log.error("notify config change watcher {} failed", watcher, e);
+                }
             } else {
                 // Don't need to notify, stay in null.
             }
         } else {
             if (!newItemValue.equals(watcher.value())) {
-                watcher.notify(new ConfigChangeWatcher.ConfigChangeEvent(
-                    newItemValue,
-                    ConfigChangeWatcher.EventType.MODIFY
-                ));
+                try {
+                    watcher.notify(new ConfigChangeWatcher.ConfigChangeEvent(
+                        newItemValue,
+                        ConfigChangeWatcher.EventType.MODIFY
+                    ));
+                } catch (Exception e) {
+                    log.error("notify config change watcher {} failed", watcher, e);
+                }
             } else {
                 // Don't need to notify, stay in the same config value.
             }
@@ -99,7 +107,11 @@ public abstract class ConfigWatcherRegister implements DynamicConfigurationServi
         });
 
         if (changedGroupItems.size() > 0) {
-            watcher.notifyGroup(changedGroupItems);
+            try {
+                watcher.notifyGroup(changedGroupItems);
+            } catch (Exception e) {
+                log.error("notify config change watcher {} failed", watcher, e);
+            }
         }
     }