From 36d34d285841328d6e727db42e5a2b47585c3f2f Mon Sep 17 00:00:00 2001 From: x12sa Date: Fri, 11 Sep 2026 09:07:25 +0200 Subject: [PATCH] fix(eps): cap alarm texts per event to stop eps_alarm_history.json growing unbounded A long-running/flapping EPS alarm appended every slightly-different AlarmList_EPS text to the open event's texts list with no limit, eventually growing eps_alarm_history.json past the upload server's size limit (HTTP 413), which then retried and re-failed indefinitely. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01XdHenMmwbrCz1juWMi1yZc --- .../plugins/OMNY_shared/eps/eps_status_generator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py index fe041318..e886ac54 100644 --- a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py +++ b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py @@ -92,6 +92,9 @@ _HISTORY_MAX = 50 # events persisted per stream _HISTORY_SHOW = 5 # events surfaced to the page per stream _TRACE_MAX = 288 # ring-current samples (24 h at 5 min) _FLAP_COALESCE_S = 60 # re-alarm within this window extends the event +_ALARM_TEXTS_MAX = 100 # distinct alarm texts kept on a single open eps_event; + # only one event is ever open at a time, so this bounds + # total history growth during a long-running flapping alarm _SEVERITY_NAMES = {0: "NO_ALARM", 1: "MINOR", 2: "MAJOR", 3: "INVALID"} @@ -235,7 +238,9 @@ class HistoryTracker: if open_ev is not None: open_ev["count"] = max(open_ev.get("count", 0), count) if text and text not in open_ev.get("texts", []): - open_ev.setdefault("texts", []).append(text) + texts = open_ev.setdefault("texts", []) + texts.append(text) + del texts[:-_ALARM_TEXTS_MAX] return # coalesce a rapid re-alarm with identical text if self.eps_events: