From c8e93f15e8584ecd54b50a496875216389d63593 Mon Sep 17 00:00:00 2001 From: morapet Date: Thu, 12 Sep 2024 19:08:04 +0200 Subject: [PATCH] prevent crash during timer expiration after stream is closed Reorder ticker stop and close merge to prevent send(true) happens after merge is closed, in rare situation when the timer expires exactly at the point between close(merge) and ticker.Stop() Signed-off-by: morapet --- server/application/logs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/application/logs.go b/server/application/logs.go index 9034da9471212..45740acc79563 100644 --- a/server/application/logs.go +++ b/server/application/logs.go @@ -144,8 +144,8 @@ func mergeLogStreams(streams []chan logEntry, bufferingDuration time.Duration) c _ = send(true) - close(merged) ticker.Stop() + close(merged) }() return merged }