Merge remote-tracking branch 'origin/topic/awelzel/fix-flaky-terminate-while-queueing'

* origin/topic/awelzel/fix-flaky-terminate-while-queueing:
  cluster/websocket: Stop and wait for reply thread during Terminate()

(cherry picked from commit 135acc7c6d)
This commit is contained in:
Arne Welzel 2025-05-07 13:21:39 +02:00
parent 01747191b6
commit 3ee6a3d6c0
4 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,9 @@
7.2.0-rc1.11 | 2025-05-07 14:06:06 +0200
* cluster/websocket: Stop and wait for reply thread during Terminate() (Arne Welzel, Corelight)
(cherry picked from commit 135acc7c6d2cd150b9090ca7563519ffadc2148e)
7.2.0-rc1.10 | 2025-05-07 11:10:09 +0200
* Websocket: Close onloop during Terminate() (Arne Welzel, Corelight)

View file

@ -1 +1 @@
7.2.0-rc1.10
7.2.0-rc1.11

View file

@ -249,6 +249,11 @@ void WebSocketEventDispatcher::Terminate() {
clients.clear();
onloop->Close();
// Wait for the reply_msg_thread to process any outstanding
// WebSocketReply messages before returning.
reply_msg_thread->SignalStop();
reply_msg_thread->WaitForStop();
}
void WebSocketEventDispatcher::QueueForProcessing(WebSocketEvent&& event) {

View file

@ -89,7 +89,7 @@ def run(ws_url):
tc.send_json(wstest.build_event_v1("/test/pings/", "ping", [f"tc{idx}", i]))
except websockets.exceptions.ConnectionClosedOK as e:
print("connection closed ok")
assert e.code == 1001 # Remote going away
assert e.code == 1001, f"expected code 1001, got {e.code} - {e}" # Remote going away
i -= 1
saw_closed_ok.add(idx)