Skip to content

Commit 66201c9

Browse files
authored
Add protection for dynamic config change propagate chain. (#12899)
1 parent b178c9d commit 66201c9

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

docs/en/changes/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* BanyanDB: Support `@EnableSort` on the column to enable sorting for `IndexRule` and set the default to false.
3838
* Support `Get Effective TTL Configurations` API.
3939
* Fix `ServerStatusService.statusWatchers` concurrent modification.
40+
* Add protection for dynamic config change propagate chain.
4041

4142
#### UI
4243

oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,25 @@ protected void notifySingleValue(final ConfigChangeWatcher watcher, ConfigTable.
3737
if (newItemValue == null) {
3838
if (watcher.value() != null) {
3939
// Notify watcher, the new value is null with delete event type.
40-
watcher.notify(
41-
new ConfigChangeWatcher.ConfigChangeEvent(null, ConfigChangeWatcher.EventType.DELETE));
40+
try {
41+
watcher.notify(
42+
new ConfigChangeWatcher.ConfigChangeEvent(null, ConfigChangeWatcher.EventType.DELETE));
43+
} catch (Exception e) {
44+
log.error("notify config change watcher {} failed", watcher, e);
45+
}
4246
} else {
4347
// Don't need to notify, stay in null.
4448
}
4549
} else {
4650
if (!newItemValue.equals(watcher.value())) {
47-
watcher.notify(new ConfigChangeWatcher.ConfigChangeEvent(
48-
newItemValue,
49-
ConfigChangeWatcher.EventType.MODIFY
50-
));
51+
try {
52+
watcher.notify(new ConfigChangeWatcher.ConfigChangeEvent(
53+
newItemValue,
54+
ConfigChangeWatcher.EventType.MODIFY
55+
));
56+
} catch (Exception e) {
57+
log.error("notify config change watcher {} failed", watcher, e);
58+
}
5159
} else {
5260
// Don't need to notify, stay in the same config value.
5361
}
@@ -99,7 +107,11 @@ protected void notifyGroupValues(final GroupConfigChangeWatcher watcher,
99107
});
100108

101109
if (changedGroupItems.size() > 0) {
102-
watcher.notifyGroup(changedGroupItems);
110+
try {
111+
watcher.notifyGroup(changedGroupItems);
112+
} catch (Exception e) {
113+
log.error("notify config change watcher {} failed", watcher, e);
114+
}
103115
}
104116
}
105117

0 commit comments

Comments
 (0)