From 96c0484308c1fe9b243e9784c3bfb2e04b86d815 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Thu, 26 Oct 2023 18:37:54 +0900 Subject: [PATCH] cshared: Handle already closed case Signed-off-by: Hiroshi Hatake --- cshared.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cshared.go b/cshared.go index fa8353b..ec55e07 100644 --- a/cshared.go +++ b/cshared.go @@ -168,6 +168,12 @@ func FLBPluginInit(ptr unsafe.Pointer) int { func flbPluginReset() { theInputLock.Lock() defer theInputLock.Unlock() + defer func() { + if ret := recover(); ret != nil { + fmt.Fprintf(os.Stderr, "Channel is already closed") + return + } + }() once = sync.Once{} close(theChannel)