Skip to content
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

Unbounded memory usage of BatchGet's cache #19560

Closed
bobotu opened this issue Aug 28, 2020 · 4 comments · Fixed by #21015
Closed

Unbounded memory usage of BatchGet's cache #19560

bobotu opened this issue Aug 28, 2020 · 4 comments · Fixed by #21015
Assignees
Labels
severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@bobotu
Copy link
Contributor

bobotu commented Aug 28, 2020

Bug Report

The internal cache used by BatchGet need a size limit, it is OK to randomly discard some entry in it.

1. Minimal reproduce step (Required)

Start a transaction, do a lot of batch get.

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

Low memory usage.

3. What did you see instead (Required)

Unbounded memory usage.

图片

4. What is your TiDB version? (Required)

v4.0, master

@bobotu bobotu added the type/bug The issue is confirmed as a bug. label Aug 28, 2020
@time-and-fate
Copy link
Member

/label sig/transaction

@ti-srebot ti-srebot added the sig/transaction SIG:Transaction label Aug 31, 2020
@ichn-hu
Copy link
Contributor

ichn-hu commented Sep 17, 2020

/assign @ichn-hu

@ichn-hu
Copy link
Contributor

ichn-hu commented Nov 12, 2020

/unassign @ichn-hu

@ti-srebot
Copy link
Contributor

ti-srebot commented Nov 19, 2020

Please edit this comment or add a new comment to complete the following information

Bug

1. Root Cause Analysis (RCA) (optional)

The internal cache used by BatchGet does not have a size limit. If the user starts a transaction and query lots of data without commit/rollback, the cache may use too much memory and result in an OOM error.

2. Symptom (optional)

TiDB OOM.

3. All Trigger Conditions (optional)

Do a large amount of query in one transaction and leave it valid forever (without commit/rollback).

4. Workaround (optional)

Find this session and kill it.

5. Affected versions

[v4.0.0:v4.0.8]

6. Fixed versions

v4.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants