From 188d012bc48470d283da862a2b657476ccb6f92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Sat, 26 Aug 2023 22:30:20 +0200 Subject: [PATCH] Fix Memory Leak caused by the merge_context. The now removed statement of sending an empty struct into the channel blocked the goroutine until the channel of Done got listened for. This led to a goroutine leak as one does not necessarily has to call the Done function of a context. We fix this issue by removing this value. It was unnecessary anyway as a closed channel always returns the null-value of the returned type. --- pkg/util/merge_context.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/util/merge_context.go b/pkg/util/merge_context.go index 9a44ec1..3413c12 100644 --- a/pkg/util/merge_context.go +++ b/pkg/util/merge_context.go @@ -39,7 +39,6 @@ func (m mergeContext) Done() <-chan struct{} { } go func(cases []reflect.SelectCase, ch chan struct{}) { _, _, _ = reflect.Select(cases) - ch <- struct{}{} close(ch) }(cases, ch) return ch