Skip to content

Commit a9f1e80

Browse files
authored
logservice: fix goroutine leak when tikv is down (pingcap#2775)
close pingcap#2776
1 parent 6c770fd commit a9f1e80

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

logservice/logpuller/region_request_worker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ func (s *regionRequestWorker) run(ctx context.Context, credential *security.Cred
178178
zap.Uint64("workerID", s.workerID),
179179
zap.String("addr", s.store.storeAddr),
180180
zap.Error(err))
181+
// Close the connection if it was partially created to prevent goroutine leaks
182+
if conn != nil && conn.Conn != nil {
183+
_ = conn.Conn.Close()
184+
}
181185
return isCanceled()
182186
}
183187
defer func() {

0 commit comments

Comments
 (0)