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

panic at the ResetContextOfStmt when to enable tidb_mem_quota_analyze #48357

Closed
hawkingrei opened this issue Nov 7, 2023 · 0 comments · Fixed by #48358
Closed

panic at the ResetContextOfStmt when to enable tidb_mem_quota_analyze #48357

hawkingrei opened this issue Nov 7, 2023 · 0 comments · Fixed by #48358

Comments

@hawkingrei
Copy link
Member

hawkingrei commented Nov 7, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

func TestMemQuotaAnalyze2(t *testing.T) {
	store := testkit.CreateMockStore(t)
	tk := testkit.NewTestKit(t, store)
	tk.MustExec("use test")
	tk.MustExec("create table tbl_2 ( col_20 decimal default 84232 , col_21 tinyint not null , col_22 int default 80814394 , col_23 mediumint default -8036687 not null , col_24 smallint default 9185 not null , col_25 tinyint unsigned default 65 , col_26 char(115) default 'ZyfroRODMbNDRZnPNRW' not null , col_27 bigint not null , col_28 tinyint not null , col_29 char(130) default 'UMApsVgzHblmY' , primary key idx_14 ( col_28,col_22 ) , unique key idx_15 ( col_24,col_22 ) , key idx_16 ( col_21,col_20,col_24,col_25,col_27,col_28,col_26,col_29 ) , key idx_17 ( col_24,col_25 ) , unique key idx_18 ( col_25,col_23,col_29,col_27,col_26,col_22 ) , key idx_19 ( col_25,col_22,col_26,col_23 ) , unique key idx_20 ( col_22,col_24,col_28,col_29,col_26,col_20 ) , key idx_21 ( col_25,col_24,col_26,col_29,col_27,col_22,col_28 ) );")
	tk.MustExec("insert ignore into tbl_2 values ( 942,33,-1915007317,3408149,-3699,193,'Trywdis',1876334369465184864,115,null );")
	tk.MustExec("set global tidb_mem_quota_analyze=128;")
	tk.MustExecToErr("analyze table tbl_2;")
}

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

passed

3. What did you see instead (Required)

failed

panic: Out Of Global Analyze Memory Limit! [recovered]
	panic: Out Of Global Analyze Memory Limit!

goroutine 28 [running]:
testing.tRunner.func1.2({0x1087fd0c0, 0xc008df46f0})
	/opt/homebrew/Cellar/go/1.21.3/libexec/src/testing/testing.go:1545 +0x274
testing.tRunner.func1()
	/opt/homebrew/Cellar/go/1.21.3/libexec/src/testing/testing.go:1548 +0x448
panic({0x1087fd0c0?, 0xc008df46f0?})
	/opt/homebrew/Cellar/go/1.21.3/libexec/src/runtime/panic.go:920 +0x26c
github.com/pingcap/tidb/pkg/executor.(*globalPanicOnExceed).Action(0xc0000c91c0, 0xc000d96320)
	/Users/weizhenwang/devel/opensource/tidb/pkg/executor/executor.go:201 +0x140
github.com/pingcap/tidb/pkg/util/memory.(*Tracker).Consume.func1(0xc000d96330, 0x40b0000000000000?)
	/Users/weizhenwang/devel/opensource/tidb/pkg/util/memory/tracker.go:437 +0x15c
github.com/pingcap/tidb/pkg/util/memory.(*Tracker).Consume(0xc000d96320, 0x1000)
	/Users/weizhenwang/devel/opensource/tidb/pkg/util/memory/tracker.go:464 +0x40c
github.com/pingcap/tidb/pkg/util/memory.(*Tracker).AttachTo(0xc007515e00, 0xc000d96320)
	/Users/weizhenwang/devel/opensource/tidb/pkg/util/memory/tracker.go:298 +0x258
github.com/pingcap/tidb/pkg/executor.ResetContextOfStmt({0x10911c8b8?, 0xc0054eec80?}, {0x1090bdce8, 0xc009502b60})
	/Users/weizhenwang/devel/opensource/tidb/pkg/executor/executor.go:2015 +0xa30
github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt(0xc0054eec80, {0x1090a9d28, 0xc008db7500}, {0x1090bdce8?, 0xc009502b60?})
	/Users/weizhenwang/devel/opensource/tidb/pkg/session/session.go:2140 +0x174
github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext(0xc00754dc70, {0x1090a9d28, 0xc008db7500}, {0x106b71612, 0x14}, {0x0, 0x0, 0x0})
	/Users/weizhenwang/devel/opensource/tidb/pkg/testkit/testkit.go:363 +0x5b0
github.com/pingcap/tidb/pkg/testkit.(*TestKit).Exec(0xc005515d80?, {0x106b71612, 0x14}, {0x0, 0x0, 0x0})
	/Users/weizhenwang/devel/opensource/tidb/pkg/testkit/testkit.go:336 +0x98
github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecToErr(0xc00754dc70, {0x106b71612, 0x14}, {0x0, 0x0, 0x0})
	/Users/weizhenwang/devel/opensource/tidb/pkg/testkit/testkit.go:418 +0x54
github.com/pingcap/tidb/pkg/executor/test/analyzetest/memorycontrol.TestMemQuotaAnalyze2(0x0?)
	/Users/weizhenwang/devel/opensource/tidb/pkg/executor/test/analyzetest/memorycontrol/memory_control_test.go:212 +0xf8
testing.tRunner(0xc000dac4e0, 0x10905ce08)
	/opt/homebrew/Cellar/go/1.21.3/libexec/src/testing/testing.go:1595 +0x198
created by testing.(*T).Run in goroutine 1
	/opt/homebrew/Cellar/go/1.21.3/libexec/src/testing/testing.go:1648 +0x5dc

4. What is your TiDB version? (Required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant