【 TiDB 使用环境】生产环境
【 TiDB 版本】v6.5.0
【复现路径】无
【遇到的问题:问题现象及影响】
TiDB集群中的TiDB节点内存和CPU升高,随后开始不断重启并重启失败,报错日志如下
看起来是在载入BindInfo的过程中使用了未初始化的指针导致了问题
删除Pod后无法恢复,目前全部的TiDB Pod全部crashed,导致集群处于不可用状态
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x313b7ce]
goroutine 1 [running]:
github.com/pingcap/tidb/executor.(*Compiler).Compile.func1()
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/compiler.go:72 +0x445
panic({0x4318e40, 0x6ec6870})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/pingcap/tidb/statistics/handle.(*Handle).GetPartitionStats(0xc00031d180?, 0x4f8da00?, 0x4f72898?, {0x0?, 0xc0046745a0?, 0x16?})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:997 +0x2e
github.com/pingcap/tidb/statistics/handle.(*Handle).GetTableStats(...)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:992
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildDataSource(0xc004a82d00, {0x4fafbb0, 0xc0046f7410}, 0xc0048c6ea0, 0xc0048b8c90)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:4456 +0x9ce
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode(0xc004a82d00, {0x4fafbb0?, 0xc0046f7410?}, {0x4fc96b0?, 0xc0048b8c40?}, 0x0?)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:380 +0x19d
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildJoin(0xc002b24f50?, {0x4fafbb0?, 0xc0046f7410?}, 0x16?)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:720 +0x71d
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode(0x0?, {0x4fafbb0?, 0xc0046f7410?}, {0x4fc8948?, 0xc001ea9950?}, 0x0?)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:367 +0x271
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildTableRefs(0xc004a82d00?, {0x4fafbb0?, 0xc0046f7410?}, 0x393d09e?)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:359 +0x85
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildSelect(0xc004a82d00, {0x4fafbb0, 0xc0046f7410}, 0xc0048ce000)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:3916 +0x6c7
github.com/pingcap/tidb/planner/core.(*PlanBuilder).Build(0xc004a82d00, {0x4fafbb0, 0xc0046f7410}, {0x4fc4080?, 0xc0048ce000?})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:804 +0x745
github.com/pingcap/tidb/planner.buildLogicalPlan({0x4fafbb0, 0xc0046f7410}, {0x501e818?, 0xc00031d180}, {0x4fc4080, 0xc0048ce000}, 0xc004a82d00)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:461 +0x12f
github.com/pingcap/tidb/planner.optimize({0x4fafbb0, 0xc0046f7410}, {0x501e818?, 0xc00031d180}, {0x4fc4080?, 0xc0048ce000?}, {0x4fe5b50, 0xc0046f7470})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:382 +0x473
github.com/pingcap/tidb/planner.Optimize({0x4fafbb0, 0xc0046f7410}, {0x501e818, 0xc00031d180}, {0x4fc4080, 0xc0048ce000}, {0x4fe5b50, 0xc0046f7470})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:245 +0xf11
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildExplain(0xc0047856c0, {0x4fafbb0, 0xc0046f7410}, 0xc0048b8cb0)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:4783 +0xd9
github.com/pingcap/tidb/planner/core.(*PlanBuilder).Build(0xc0047856c0, {0x4fafbb0, 0xc0046f7410}, {0x4fc2c80?, 0xc0048b8cb0?})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:779 +0x432
github.com/pingcap/tidb/planner.buildLogicalPlan({0x4fafbb0, 0xc0046f7410}, {0x501e818?, 0xc00031d180}, {0x4fc2c80, 0xc0048b8cb0}, 0xc0047856c0)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:461 +0x12f
github.com/pingcap/tidb/planner.optimize({0x4fafbb0, 0xc0046f7410}, {0x501e818?, 0xc00031d180}, {0x4fc2c80?, 0xc0048b8cb0?}, {0x4fe5b50, 0xc0046f7470})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:382 +0x473
github.com/pingcap/tidb/planner.Optimize({0x4fafbb0, 0xc0046f7410}, {0x501e818, 0xc00031d180}, {0x4fc2c80, 0xc0048b8cb0}, {0x4fe5b50, 0xc0046f7470})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:245 +0xf11
github.com/pingcap/tidb/executor.(*Compiler).Compile(0xc002b26fc8, {0x4fafbb0, 0xc0046f7410}, {0x4fc8580, 0xc0048b8cb0?})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/compiler.go:116 +0x6f8
github.com/pingcap/tidb/session.(*session).ExecuteStmt(0xc00031d180, {0x4fafbb0, 0xc0046f7410}, {0x4fc8580?, 0xc0048b8cb0})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:2171 +0x54e
github.com/pingcap/tidb/session.(*session).ExecuteInternal(0xc00031d180, {0x4fafbb0, 0xc0046f7410}, {0xc0048be900, 0x11f}, {0x0, 0x0, 0x0})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:1674 +0x3f2
github.com/pingcap/tidb/bindinfo.getHintsForSQL({0x501e818, 0xc00031d180}, {0xc00086e580, 0x109})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/bindinfo/handle.go:951 +0x177
github.com/pingcap/tidb/bindinfo.(*BindRecord).prepareHints(0xc0046e94c0, {0x501e818, 0xc00031d180})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/bindinfo/bind_record.go:178 +0x1e7
github.com/pingcap/tidb/bindinfo.(*BindHandle).newBindRecord(0xc00478ba80, {0xc0047fe2d0?, 0x1?})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/bindinfo/handle.go:723 +0xbcf
github.com/pingcap/tidb/bindinfo.(*BindHandle).Update(0xc00478ba80, 0x1)
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/bindinfo/handle.go:173 +0x6c5
github.com/pingcap/tidb/domain.(*Domain).LoadBindInfoLoop(0xc0016b8000, {0x501e818, 0xc00031d180}, {0x501e818, 0xc000742780})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/domain/domain.go:1444 +0xe5
github.com/pingcap/tidb/session.BootstrapSession({0x4fd95f0, 0xc000d25900})
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:3301 +0x648
main.createStoreAndDomain()
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:314 +0x1cb
main.main()
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:214 +0x2ca