From c77b90409ae204e8b58e0c54ddac1b8d4479fe79 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Mon, 23 Oct 2023 09:33:34 +0200 Subject: [PATCH] Fix hang on error Signed-off-by: Dirkjan Bussink --- go/vt/vtgate/engine/concatenate.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/go/vt/vtgate/engine/concatenate.go b/go/vt/vtgate/engine/concatenate.go index 04d08245b0e..2692f34695d 100644 --- a/go/vt/vtgate/engine/concatenate.go +++ b/go/vt/vtgate/engine/concatenate.go @@ -310,8 +310,15 @@ func (c *Concatenate) parallelStreamExec(inCtx context.Context, vcursor VCursor, return callback(resultChunk, currIndex) }) if err != nil { + muFields.Lock() + if rest[currIndex] == nil { + // In case we haven't received any fields yet, we need to set it + // empty, or otherwise we will keep waiting forever. + rest[currIndex] = &sqltypes.Result{} + } cancel() condFields.Broadcast() + muFields.Unlock() } return err })