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

memory_quota: Lost connection in InsertStmt #18112

Closed
ChenPeng2013 opened this issue Jun 18, 2020 · 2 comments · Fixed by #18494
Closed

memory_quota: Lost connection in InsertStmt #18112

ChenPeng2013 opened this issue Jun 18, 2020 · 2 comments · Fixed by #18494
Labels
epic/memory-management severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
drop table if exists t;
create table t(a int);
insert into t values(1), (-1), (0);
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert /*+ memory_quota(15 MB) */ into t select * from t;

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

mysql> insert /*+ memory_quota(15 MB) */ into t select * from t;
ERROR 1105 (HY000): Out Of Memory Quota![conn_id=7]

3. What did you see instead (Required)

mysql> insert /*+ memory_quota(15 MB) */ into t select * from t;
ERROR 2013 (HY000): Lost connection to MySQL server during query

4. Affected version (Required)

Release Version: v4.0.0-72-gfe073f2bc
Edition: Community
Git Commit Hash: fe073f2bc2e5f578e52bdd24ecbc7aae8cd51210
Git Branch: release-4.0
UTC Build Time: 2020-06-18 06:10:50
GoVersion: go1.13.1
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

5. Root Cause Analysis

@ChenPeng2013 ChenPeng2013 added the type/bug The issue is confirmed as a bug. label Jun 18, 2020
@SunRunAway
Copy link
Contributor

Could you provide the tidb log?

@ChenPeng2013
Copy link
Contributor Author

It can be reproduced

[2020/07/02 15:59:17.470 +08:00] [WARN] [expensivequery.go:168] [expensive_query] [cost_time=13.431838603s] [cop_time=12.249089046s] [request_count=1] [num_cop_tasks=1] [process_avg_time=0s] [process_p90_time=0s] [process_max_time=0s] [process_max_addr=store1] [wait_avg_time=0s] [wait_p90_time=0s] [wait_max_time=0s] [wait_max_addr=store1] [stats=t:pseudo] [conn_id=1] [user=root] [database=test] [table_ids="[59]"] [txn_start_ts=417772796389097472] [mem_max="18087936 Bytes (17.25 MB)"] [sql="insert /*+ memory_quota(15 MB) */ into t select * from t"]
[2020/07/02 15:59:17.471 +08:00] [ERROR] [conn.go:660] ["connection running loop panic"] [conn=1] [lastSQL="insert /*+ memory_quota(15 MB) */ into t select * from t"] [err="Out Of Memory Quota![conn_id=1]"] [stack="goroutine 336 [running]:\ngithub.com/pingcap/tidb/server.(*clientConn).Run.func1(0x65f5e20, 0xc0009804b0, 0xc000544000)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/conn.go:658 +0xee\npanic(0x5c26300, 0xc00482ad90)\n\t/usr/local/go/src/runtime/panic.go:679 +0x1b2\ngithub.com/pingcap/tidb/util/memory.(*PanicOnExceed).Action(0xc001c980a0, 0xc004744f50)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/util/memory/action.go:96 +0x184\ngithub.com/pingcap/tidb/util/memory.(*Tracker).Consume(0xc004744f50, 0x8a0000)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/util/memory/tracker.go:221 +0x118\ngithub.com/pingcap/tidb/session.(*session).StmtCommit(0xc0010a8000, 0xc004744f50, 0x0, 0x0)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/session/txn.go:570 +0xa04\ngithub.com/pingcap/tidb/session.runStmt(0x65f5e20, 0xc0009804b0, 0x6638d20, 0xc0010a8000, 0x65ff2a0, 0xc00197cf80, 0x0, 0x0, 0x0, 0x0)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/session/tidb.go:290 +0x778\ngithub.com/pingcap/tidb/session.(*session).executeStatement(0xc0010a8000, 0x65f5e20, 0xc0009804b0, 0x1, 0x65fe7a0, 0xc0005a85b0, 0x65ff2a0, 0xc00197cf80, 0x0, 0x0, ...)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/session/session.go:1038 +0xb5\ngithub.com/pingcap/tidb/session.(*session).execute(0xc0010a8000, 0x65f5e20, 0xc0009804b0, 0xc0019aa041, 0x38, 0xc0035ff170, 0x6624ec0, 0xc0038b5b00, 0x6086448, 0x4)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/session/session.go:1151 +0x78d\ngithub.com/pingcap/tidb/session.(*session).Execute(0xc0010a8000, 0x65f5e20, 0xc0009804b0, 0xc0019aa041, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/session/session.go:1081 +0xdb\ngithub.com/pingcap/tidb/server.(*TiDBContext).Execute(0xc0009aab10, 0x65f5e20, 0xc0009804b0, 0xc0019aa041, 0x38, 0x4030ab1, 0x6179250, 0xc0035ff278, 0xc0035ff268, 0x40d05c2)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/driver_tidb.go:248 +0x7c\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery(0xc000544000, 0x65f5e20, 0xc0009804b0, 0xc0019aa041, 0x38, 0x0, 0x0)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/conn.go:1265 +0x91\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch(0xc000544000, 0x65f5e20, 0xc0009804b0, 0xc0019aa041, 0x39, 0x38, 0x0, 0x0)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/conn.go:899 +0x5e2\ngithub.com/pingcap/tidb/server.(*clientConn).Run(0xc000544000, 0x65f5e20, 0xc0009804b0)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/conn.go:713 +0x27c\ngithub.com/pingcap/tidb/server.(*Server).onConn(0xc000e5ac60, 0xc000544000)\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/server.go:415 +0xb12\ncreated by github.com/pingcap/tidb/server.(*Server).Run\n\t/Users/chenpeng/go/src/github.com/pingcap/tidb/server/server.go:333 +0x709\n"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/memory-management severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants