pingcap / pingcap/tidb

indexmerge exits slowly when `Out Of Memory Quota` panic is triggered

Open
#42,398 0 comments 0 reactions 0 assignees View on GitHub
affects-6.5 affects-7.1 affects-7.5 affects-8.1 affects-8.5 may-affects-4.0 may-affects-5.0 may-affects-5.1 may-affects-5.2 may-affects-5.3 may-affects-5.4 may-affects-6.1 severity/major sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
TiDB crashed because of OOM.

- From the log, we know that the global memory controller sent the kill signal to query with top 1 memory usage successfully, and trigger the cancelAction successfully.
```
[2023/03/14 01:32:16.740 +00:00] [WARN] [servermemorylimit.go:126] ["global memory controller tries to kill the top1 memory consumer"] [connID=8123979156334580095] ["sql digest"=] ["sql text"="SELECT xxx"] [tidb_server_memory_limit=11510510320] ["heap inuse"=13101236224] ["sql memory usage"=4235421387]2023-03-14 09:32:16
[2023/03/14 01:32:17.027 +00:00] [WARN] [tracker.go:458] ["global memory controller, NeedKill signal is received successfully"] [connID=8123979156334580095]
```

- But the query exit slowly, thus blocking the global memory controller from killing the next sql, and causing the OOM.

No log like `global memory controller killed the top1 memory consumer successfully` was printed before the OOM happened.

- The query that blocks the global memory controller used IndexMerge.

### 2. What did you expect to see? (Required)

### 3. What did you see instead (Required)

### 4. What is your TiDB version? (Required)

release-6.5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.