From d9785635233d94e7a25297584637560605c41c6d Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sat, 27 Aug 2022 22:47:25 +0800 Subject: [PATCH] fix: more accurate panic message on mapreduce (#2311) --- core/mr/mapreduce.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/mr/mapreduce.go b/core/mr/mapreduce.go index 5e78e846..1734f7ce 100644 --- a/core/mr/mapreduce.go +++ b/core/mr/mapreduce.go @@ -212,6 +212,8 @@ func mapReduceWithPanicChan(source <-chan interface{}, panicChan *onceChan, mapp cancel(context.DeadlineExceeded) return nil, context.DeadlineExceeded case v := <-panicChan.channel: + // drain output here, otherwise for loop panic in defer + drain(output) panic(v) case v, ok := <-output: if err := retErr.Load(); err != nil {