Skip to content

Commit 7e29bf7

Browse files
authored
executor: fix goroutine leak when exceed quota in hash agg (#58078) (#61805)
close #58004
1 parent b37cf0e commit 7e29bf7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/executor/aggregate/agg_hash_executor.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ func (e *HashAggExec) Close() error {
190190
channel.Clear(e.finalOutputCh)
191191
e.executed = false
192192
if e.memTracker != nil {
193-
e.memTracker.ReplaceBytesUsed(0)
193+
if e.memTracker.BytesConsumed() > 0 {
194+
e.memTracker.ReplaceBytesUsed(0)
195+
}
194196
}
195197
e.parallelExecValid = false
196198
}
@@ -351,6 +353,7 @@ func (e *HashAggExec) fetchChildData(ctx context.Context, waitGroup *sync.WaitGr
351353
ok bool
352354
err error
353355
)
356+
354357
defer func() {
355358
if r := recover(); r != nil {
356359
recoveryHashAgg(e.finalOutputCh, r)

0 commit comments

Comments
 (0)