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/20 12:45:07 UTC

(skywalking) branch master updated: Fix `ServerStatusService.statusWatchers` concurrent modification. (#12884)

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 6d262cce62 Fix `ServerStatusService.statusWatchers` concurrent modification. (#12884)
6d262cce62 is described below

commit 6d262cce62e156bd197177abb3640ea65bb2d38e
Author: weixiang1862 <65...@qq.com>
AuthorDate: Fri Dec 20 20:45:00 2024 +0800

    Fix `ServerStatusService.statusWatchers` concurrent modification. (#12884)
---
 docs/en/changes/changes.md                                            | 1 +
 .../apache/skywalking/oap/server/core/status/ServerStatusService.java | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 7666e96950..71e38ac65d 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -36,6 +36,7 @@
 * BanyanDB: Speed up OAP booting while initializing BanyanDB.
 * 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.
 
 #### UI
 
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java
index 3559a9de8c..a6dea09e2f 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java
@@ -18,8 +18,8 @@
 
 package org.apache.skywalking.oap.server.core.status;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import org.apache.skywalking.oap.server.core.CoreModuleConfig;
@@ -46,7 +46,7 @@ public class ServerStatusService implements Service {
     @Getter
     private ClusterStatus clusterStatus = new ClusterStatus();
 
-    private List<ServerStatusWatcher> statusWatchers = new ArrayList<>();
+    private List<ServerStatusWatcher> statusWatchers = new CopyOnWriteArrayList<>();
 
     private List<ApplicationConfiguration.ModuleConfiguration> configurations;