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 when explain analyze update statement #20389

Closed
crazycs520 opened this issue Oct 10, 2020 · 3 comments · Fixed by #20390
Closed

panic when explain analyze update statement #20389

crazycs520 opened this issue Oct 10, 2020 · 3 comments · Fixed by #20390
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@crazycs520
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (a int key, b int);
insert into t values (1,1);
explain analyze update t1 set b=b+1;  -- panic
[2020/10/10 17:23:03.202 +08:00] [INFO] [conn.go:794] ["command dispatched failed"] [conn=1] [connInfo="id:1, addr:127.0.0.1:53342 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="explain analyze update t set b=b+1"] [txn_mode=OPTIMISTIC] [err="runtime error: invalid memory address or nil pointer dereference
github.com/pingcap/tidb/executor.(*recordSet).Next.func1
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/adapter.go:124
runtime.gopanic
	/usr/local/go/src/runtime/panic.go:969
runtime.panicmem
	/usr/local/go/src/runtime/panic.go:212
runtime.sigpanic
	/usr/local/go/src/runtime/signal_unix.go:695
github.com/pingcap/tidb/session.(*TxnState).GetSnapshot
	<autogenerated>:1
github.com/pingcap/tidb/executor.(*UpdateExec).Close
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/update.go:276
github.com/pingcap/tidb/executor.(*ExplainExec).generateExplainInfo.func1
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/explain.go:79
github.com/pingcap/tidb/executor.(*ExplainExec).generateExplainInfo
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/explain.go:114
github.com/pingcap/tidb/executor.(*ExplainExec).Next
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/explain.go:54
github.com/pingcap/tidb/executor.Next
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/executor.go:268
github.com/pingcap/tidb/executor.(*recordSet).Next
	/Users/cs/code/goread/src/github.com/pingcap/tidb/executor/adapter.go:128
github.com/pingcap/tidb/server.(*tidbResultSet).Next
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/driver_tidb.go:284
github.com/pingcap/tidb/server.(*clientConn).writeChunks
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/conn.go:1672
github.com/pingcap/tidb/server.(*clientConn).writeResultset
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/conn.go:1632
github.com/pingcap/tidb/server.(*clientConn).handleStmt
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/conn.go:1539
github.com/pingcap/tidb/server.(*clientConn).handleQuery
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/conn.go:1405
github.com/pingcap/tidb/server.(*clientConn).dispatch
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/conn.go:992
github.com/pingcap/tidb/server.(*clientConn).Run
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/conn.go:777
github.com/pingcap/tidb/server.(*Server).onConn
	/Users/cs/code/goread/src/github.com/pingcap/tidb/server/server.go:421
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373"]

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

Execute successfully.

3. What did you see instead (Required)

execute failed.

4. What is your TiDB version? (Required)

test> select tidb_version();
+-------------------------------------------------------------------+
| tidb_version()                                                    |
+-------------------------------------------------------------------+
| Release Version: v4.0.0-beta.2-1346-gc704b9756                    |
| Edition: Community                                                |
| Git Commit Hash: c704b9756e20d172da32e95f2c7bec3c40dbaff3         |
| Git Branch: master                                                |
| UTC Build Time: 2020-10-10 09:24:38                               |
| GoVersion: go1.14.4                                               |
| Race Enabled: false                                               |
| TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 |
| Check Table Before Drop: false                                    |
+-------------------------------------------------------------------+
@sre-bot
Copy link
Contributor

sre-bot commented Oct 13, 2020

Integrity check:
component severity RCA symptom trigger_condition affect_version fix_version fields are empty
@crazycs520
Please comment /info to get template

@ti-srebot
Copy link
Contributor

ti-srebot commented Oct 13, 2020

Please edit this comment to complete the following information

Bug

1. Root Cause Analysis (RCA)

duplicate call analyze executor Close method

2. Symptom

panic when execute explain analyze update statement.

3. All Trigger Conditions

see in Minimal reproduce step

4. Workaround (optional)

5. Affected versions

master

6. Fixed versions

master

@seiya-annie
Copy link

add sig label based on labels in PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
4 participants