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

runtime error: invalid memory address or nil pointer dereference by merge unconsumedCopStats #51928

Closed
Tracked by #41316
jiyfhust opened this issue Mar 20, 2024 · 4 comments · Fixed by #51950
Closed
Tracked by #41316
Labels
component/test severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@jiyfhust
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

    analyze_test.go:1874: 

        	Error Trace:	pkg/executor/test/analyzetest/analyze_test.go:1874

        	            				pkg/executor/test/analyzetest/analyze_test.go:2027

        	            				pkg/executor/test/analyzetest/analyze_test.go:2030

        	Error:      	Not equal: 

        	            	expected: "[executor:1317]Query execution was interrupted"

        	            	actual  : "runtime error: invalid memory address or nil pointer dereference"

        	            	

        	            	Diff:

        	            	--- Expected

        	            	+++ Actual

        	            	@@ -1 +1 @@

        	            	-[executor:1317]Query execution was interrupted

        	            	+runtime error: invalid memory address or nil pointer dereference

        	Test:       	TestKillAutoAnalyzeIndex

        	Messages:   	kill running analyze job

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

@jiyfhust jiyfhust added the type/bug The issue is confirmed as a bug. label Mar 20, 2024
@jiyfhust
Copy link
Contributor Author

/component test

@jiyfhust
Copy link
Contributor Author

jiyfhust commented Mar 20, 2024

Introduced by #51787.

diff --git a/pkg/distsql/select_result.go b/pkg/distsql/select_result.go
@@ -607,6 +613,15 @@ func (r *selectResult) Close() error {
                unconsumedCopStats := unconsumed.CollectUnconsumedCopRuntimeStats()
                for _, copStats := range unconsumedCopStats {
                        _ = r.updateCopRuntimeStats(context.Background(), copStats, time.Duration(0))
+                       if (r.ctx == nil) {
+                               logutil.BgLogger().Error("iiiiiiiiiiiiii")
+                       }

then go test --tags=intest --run="TestKillAutoAnalyzeIndex"

when test fails, where will be a log:

[2024/03/20 16:23:33.236 +08:00] [ERROR] [select_result.go:611] [iiiiiiiiiiiiii] [stack="github.com/pingcap/tidb/pkg/distsql............

@jiyfhust jiyfhust changed the title unstable test TestKillAutoAnalyzeIndex runtime error by merge unconsumedCopStats Mar 20, 2024
@jiyfhust jiyfhust changed the title runtime error by merge unconsumedCopStats runtime error: invalid memory address or nil pointer dereference by merge unconsumedCopStats Mar 20, 2024
@jebter jebter added the sig/planner SIG: Planner label Mar 21, 2024
@jiyfhust
Copy link
Contributor Author

/severity moderate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants