From 6d262cce62e156bd197177abb3640ea65bb2d38e Mon Sep 17 00:00:00 2001 From: weixiang1862 <652048614@qq.com> Date: Fri, 20 Dec 2024 20:45:00 +0800 Subject: [PATCH] Fix `ServerStatusService.statusWatchers` concurrent modification. (#12884) --- docs/en/changes/changes.md | 1 + .../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 7666e96950a4..71e38ac65d44 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 3559a9de8c95..a6dea09e2f3e 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 statusWatchers = new ArrayList<>(); + private List statusWatchers = new CopyOnWriteArrayList<>(); private List configurations;