Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
Signed-off-by: Ping Yu <yuping@pingcap.com>
  • Loading branch information
pingyu committed Aug 14, 2023
1 parent e369611 commit 7b09dc5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion 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.

Check warning on line 2611 in executor/simple.go

View check run for this annotation

Codecov / codecov/patch

executor/simple.go#L2611

Added line #L2611 was not covered by tests
Build()
if err != nil {
return err
Expand All @@ -2617,7 +2618,14 @@ func killRemoteConn(ctx context.Context, sctx sessionctx.Context, gcid *globalco
err := errors.New("client returns nil response")
return err
}
resp.Close()

// 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)
}

Check warning on line 2628 in executor/simple.go

View check run for this annotation

Codecov / codecov/patch

executor/simple.go#L2623-L2628

Added lines #L2623 - L2628 were not covered by tests

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

0 comments on commit 7b09dc5

Please sign in to comment.