Skip to content

Commit bdb0d7a

Browse files
committed
sql: fix cancel leak in happy case in fingerprint_span
The recent fix introduced a possible leak of the cancel function (namely, in the happy case when the coordinator doesn't hit an early error, we would never call the cancellation function). We should just defer it unconditionally and might call it earlier on a shutdown due to an error. Release note: None
1 parent 59789f4 commit bdb0d7a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/sql/fingerprint_span.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func (p *planner) fingerprintSpanFanout(
139139
// the coordinator encounters an error.
140140
workCh := make(chan roachpb.Span)
141141
ctx, cancel := context.WithCancel(ctx)
142+
defer cancel()
142143

143144
grp := ctxgroup.WithContext(ctx)
144145
for range maxWorkerCount {

0 commit comments

Comments
 (0)