analyze worker didn't exit successfully when panic during analyze table #51993
Closed
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
import a table with 500+ partition
execute "analyze table xxx"
2. What did you expect to see? (Required)
analyze table can be executed successfully
3. What did you see instead (Required)
the jobs are stuck
2024-03-21 16:32:36 (UTC+08:00)TiDB tc-tidb-0.tc-tidb-peer.sql-mvindex-40t-testing-tps-7500536-1-617.svc:4000[servermemorylimit.go:107] ["global memory controller failed to kill the top-consumer in 23648s"] [conn=2376119218] ["sql digest"=2a9574a60b4ac9685e9997742a93a6240d7219402333a804218f45a0de5be2ee] ["sql text"="analyze table db0.table0"] ["sql memory usage"=0]
2024-03-21 09:58:27 (UTC+08:00)TiDB tc-tidb-0.tc-tidb-peer.sql-mvindex-40t-testing-tps-7500536-1-617.svc:4000[analyze_col_v2.go:715] ["analyze worker panicked"] [recover="[executor:8176]Your query has been cancelled due to exceeding the allowed memory limit for the tidb-server instance and this query is currently using the most memory. Please try narrowing your query scope or increase the tidb_server_memory_limit and try again.[conn=2376119218]"] [stack="github.com/pingcap/tidb/pkg/executor.(*AnalyzeColumnsExecV2).subBuildWorker.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_col_v2.go:715\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:914\ngithub.com/pingcap/tidb/pkg/util/memory.(*Tracker).Consume\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/util/memory/tracker.go:459\ngithub.com/pingcap/tidb/pkg/statistics.BuildHistAndTopN.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/statistics/builder.go:250\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:914\ngithub.com/pingcap/tidb/pkg/util/memory.(*Tracker).Consume\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/util/memory/tracker.go:459\ngithub.com/pingcap/tidb/pkg/statistics.buildHist.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/statistics/builder.go:167\ngithub.com/pingcap/tidb/pkg/statistics.buildHist\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/statistics/builder.go:206\ngithub.com/pingcap/tidb/pkg/statistics.BuildHistAndTopN\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/statistics/builder.go:444\ngithub.com/pingcap/tidb/pkg/executor.(*AnalyzeColumnsExecV2).subBuildWorker\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_col_v2.go:854\ngithub.com/pingcap/tidb/pkg/executor.(*AnalyzeColumnsExecV2).buildSamplingStats.func6\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_col_v2.go:402\ngithub.com/pingcap/tidb/pkg/executor.(*notifyErrorWaitGroupWrapper).Run.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_utils.go:133"]
4. What is your TiDB version? (Required)
master