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

TiDB panic when run with tidb_enable_collect_execution_info=0 in TiKV env #48212

Closed
Defined2014 opened this issue Nov 2, 2023 · 4 comments · Fixed by #48340
Closed

TiDB panic when run with tidb_enable_collect_execution_info=0 in TiKV env #48212

Defined2014 opened this issue Nov 2, 2023 · 4 comments · Fixed by #48340

Comments

@Defined2014
Copy link
Contributor

Defined2014 commented Nov 2, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Run integration test in TiKV env many times, it will panic forever in some rounds. And we will get log like

[2023/11/02 02:13:07.738 +08:00] [ERROR] [coprocessor.go:1117] ["copIteratorWork meet panic"] [r="runtime error: invalid memory address or nil pointer dereference"] ["stack trace"="github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask.func1
	/home/jenkins/agent/workspace/pingcap/tidb/periodics_integration_test/tidb/pkg/store/copr/coprocessor.go:1119
runtime.gopanic
	/usr/local/go/src/runtime/panic.go:914
runtime.panicmem
	/usr/local/go/src/runtime/panic.go:261
runtime.sigpanic
	/usr/local/go/src/runtime/signal_unix.go:861
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleCopCache
	/home/jenkins/agent/workspace/pingcap/tidb/periodics_integration_test/tidb/pkg/store/copr/coprocessor.go:1688
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleCopResponse
	/home/jenkins/agent/workspace/pingcap/tidb/periodics_integration_test/tidb/pkg/store/copr/coprocessor.go:1437
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTaskOnce
	/home/jenkins/agent/workspace/pingcap/tidb/periodics_integration_test/tidb/pkg/store/copr/coprocessor.go:1278
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask
	/home/jenkins/agent/workspace/pingcap/tidb/periodics_integration_test/tidb/pkg/store/copr/coprocessor.go:1130
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).run
	/home/jenkins/agent/workspace/pingcap/tidb/periodics_integration_test/tidb/pkg/store/copr/coprocessor.go:817"]

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

No panic

3. What did you see instead (Required)

panic forever.

4. What is your TiDB version? (Required)

master

Related log link

https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fperiodics_integration_test/detail/periodics_integration_test/171/artifacts/

Log file
integration-test.txt.zip

@ti-chi-bot ti-chi-bot bot added may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 labels Nov 2, 2023
@you06 you06 self-assigned this Nov 2, 2023
@jebter jebter added the sig/transaction SIG:Transaction label Nov 6, 2023
@you06
Copy link
Contributor

you06 commented Nov 7, 2023

Seems it only affects the internal DDL tasks.

result, err := distsql.Select(ctx.ddlJobCtx, sctx, kvReq, getColumnsTypes(handleCols))

Whether tidb_enable_collect_execution_info is enabled or not, the cache keys are same for the tasks. So after tidb_enable_collect_execution_info is turned off, if the copr cache it hit, TiDB will panic.

But the panic will be catched, so it's not such serious IMO 🤔.

@you06
Copy link
Contributor

you06 commented Nov 7, 2023

@jebter can we change it to sig/execution, since this is just a coprocessor issue, and it's not related to transaction modules?

@jebter jebter added sig/execution SIG execution and removed sig/transaction SIG:Transaction labels Nov 7, 2023
@you06 you06 removed may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 labels Nov 7, 2023
@you06
Copy link
Contributor

you06 commented Nov 7, 2023

I checked the code and it shows this bug also exists in 6.1, 6.5 and 7.1, but the fix is not necassary since turnning tidb_enable_collect_execution_info on is a workaround. Actually only few users turnoff it.

@you06
Copy link
Contributor

you06 commented Nov 9, 2023

Since option.EnableCollectExecutionInfo is loaded from instance variable after dag is generated, this panic may happens in any statements.

EnableCollectExecutionInfo: config.GetGlobalConfig().Instance.EnableCollectExecutionInfo.Load(),

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.

3 participants