From 16efb6dac5b7c73d836e6878a0cf9187c888d7a0 Mon Sep 17 00:00:00 2001 From: l1b0k Date: Thu, 23 Jan 2025 20:01:12 +0800 Subject: [PATCH] fix: potential deadlock Signed-off-by: l1b0k --- pkg/eni/manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/eni/manager.go b/pkg/eni/manager.go index 861201ed..77ab0823 100644 --- a/pkg/eni/manager.go +++ b/pkg/eni/manager.go @@ -207,7 +207,11 @@ func (m *Manager) Allocate(ctx context.Context, cni *daemon.CNI, req *AllocReque cancel() break } - resultCh <- resp.NetworkConfigs + + select { + case <-ctx.Done(): + case resultCh <- resp.NetworkConfigs: + } } }() }