From 07c1f43d952fe423d194236dd8fc32871795ad4c Mon Sep 17 00:00:00 2001 From: Zhen Ye Date: Mon, 30 Dec 2024 17:50:51 +0800 Subject: [PATCH] fix: the retrieve plan on heap is used after free when reduce (#38840) issue: #38731 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 06958f7aec79b..8e7adfdab3262 100644 --- a/internal/querynodev2/segments/result.go +++ b/internal/querynodev2/segments/result.go @@ -545,7 +545,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 }