Skip to content

Commit 7b09dc5

Browse files
committed
polish
Signed-off-by: Ping Yu <[email protected]>
1 parent e369611 commit 7b09dc5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

executor/simple.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,7 @@ func killRemoteConn(ctx context.Context, sctx sessionctx.Context, gcid *globalco
26082608
SetFromInfoSchema(sctx.GetInfoSchema()).
26092609
SetStoreType(kv.TiDB).
26102610
SetTiDBServerID(gcid.ServerID).
2611+
SetStartTS(math.MaxUint64). // To make check visibility success.
26112612
Build()
26122613
if err != nil {
26132614
return err
@@ -2617,7 +2618,14 @@ func killRemoteConn(ctx context.Context, sctx sessionctx.Context, gcid *globalco
26172618
err := errors.New("client returns nil response")
26182619
return err
26192620
}
2620-
resp.Close()
2621+
2622+
// Must consume & close the response, otherwise coprocessor task will leak.
2623+
defer func() {
2624+
_ = resp.Close()
2625+
}()
2626+
if _, err := resp.Next(ctx); err != nil {
2627+
return errors.Trace(err)
2628+
}
26212629

26222630
logutil.BgLogger().Info("Killed remote connection", zap.Uint64("serverID", gcid.ServerID),
26232631
zap.Uint64("conn", gcid.ToConnID()), zap.Bool("query", query))

0 commit comments

Comments
 (0)