Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions executor/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -2608,6 +2608,7 @@ func killRemoteConn(ctx context.Context, sctx sessionctx.Context, gcid *globalco
SetFromInfoSchema(sctx.GetInfoSchema()).
SetStoreType(kv.TiDB).
SetTiDBServerID(gcid.ServerID).
SetStartTS(math.MaxUint64). // To make check visibility success.
Build()
if err != nil {
return err
Expand All @@ -2618,6 +2619,14 @@ func killRemoteConn(ctx context.Context, sctx sessionctx.Context, gcid *globalco
return err
}

// Must consume & close the response, otherwise coprocessor task will leak.
defer func() {
_ = resp.Close()
}()
if _, err := resp.Next(ctx); err != nil {
return errors.Trace(err)
}

logutil.BgLogger().Info("Killed remote connection", zap.Uint64("serverID", gcid.ServerID),
zap.Uint64("conn", gcid.ToConnID()), zap.Bool("query", query))
return err
Expand Down