From 454ff2f1df499ee294867726be3f054bfd2831b0 Mon Sep 17 00:00:00 2001 From: congqixia Date: Mon, 24 Oct 2022 14:31:29 +0800 Subject: [PATCH] Fix ctx confusion caused goroutine leakage (#20017) Signed-off-by: Congqi Xia Signed-off-by: Congqi Xia --- internal/querynode/query_shard.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/querynode/query_shard.go b/internal/querynode/query_shard.go index 9d1ff5fc44..8412d369ab 100644 --- a/internal/querynode/query_shard.go +++ b/internal/querynode/query_shard.go @@ -29,9 +29,6 @@ import ( ) type queryShard struct { - ctx context.Context - cancel context.CancelFunc - collectionID UniqueID collection *Collection // quick reference from meta channel Channel @@ -80,10 +77,7 @@ func newQueryShard( return nil, err } - ctx, cancel := context.WithCancel(ctx) qs := &queryShard{ - ctx: ctx, - cancel: cancel, collectionID: collectionID, collection: collection, channel: channel, @@ -104,7 +98,9 @@ func newQueryShard( // Close cleans query shard func (q *queryShard) Close() { - q.cancel() + if q.vectorChunkManager != nil { + q.vectorChunkManager.Close() + } } type tsType int32