-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TiDB Server crashing w/ OOM despite the tidb_mem_quota_query limit #32287
Comments
Hi, @coderplay |
We may try to set tidb_enable_rate_limit_action to |
IIUC, the hashtable isn't accounted, see https://github.com/pingcap/tidb/blob/master/executor/hash_table.go#L187. Could you please let me know which lines of code it does the accounting? Please be aware that there are 4 big memory consumers in this issue. |
hashtable stores the key and rowPtr, the memory of it is not tracked: Lines 82 to 83 in 954e1e1
|
@XuHuaiyu yep, we are on the same page now. Looking forward to the fix. |
There are three memory untracked issues mentioned in this issue
|
Close this issue, because we fix this problem in the duplicate issue |
Bug Report
1. Minimal reproduce step (Required)
huge hash join
2. What did you expect to see? (Required)
We are mimicking our production workloads to a dev TiDB cluster. One of the biggest queries is a huge hash join, which can consume ~50GB of memory. We reduce the
tidb_mem_quota_query
to 1GB to avoid system's oom-killing, but the setting didn't work.After diving deeper into the
hashjoinExecutor
implementation, we figure out that's because below memory usages are not counted in the memory tracker:Besides above
func (worker *copIteratorWorker) handleCopResponse
can take another 2~4 GB in our case.I am attaching a heap profiling to this ticket, please check it out. We took the profiling when the TiDB server was still alive, taking around 15.8GB heap memory, but eventually, it can consume ~50GB.
3. What did you see instead (Required)
tidb server get killed by system's oom-killer
4. What is your TiDB version? (Required)
5.2.2 on kubernetes
The text was updated successfully, but these errors were encountered: