From 49b2cecfc94a008c82a3d67c8ebe28f74ad240bf Mon Sep 17 00:00:00 2001 From: chyezh Date: Mon, 30 Dec 2024 13:58:33 +0800 Subject: [PATCH] fix: the on heap is used after free when reduce Signed-off-by: chyezh --- internal/querynodev2/segments/result.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/querynodev2/segments/result.go b/internal/querynodev2/segments/result.go index 1c0ded1bf92ad..a505ce8dde9b9 100644 --- a/internal/querynodev2/segments/result.go +++ b/internal/querynodev2/segments/result.go @@ -674,7 +674,9 @@ func MergeSegcoreRetrieveResults(ctx context.Context, retrieveResults []*segcore }) futures = append(futures, future) } - if err := conc.AwaitAll(futures...); err != nil { + // Must be BlockOnAll operation here. + // If we perform a fast fail here, the cgo struct like `plan` will be used after free, unsafe memory access happens. + if err := conc.BlockOnAll(futures...); err != nil { return nil, err }