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 crashes when trying to recover non-existing table #46296

Closed
SteveLeungYL opened this issue Aug 22, 2023 · 2 comments · Fixed by #46343
Closed

TiDB crashes when trying to recover non-existing table #46296

SteveLeungYL opened this issue Aug 22, 2023 · 2 comments · Fixed by #46343
Assignees
Labels
affects-6.1 affects-6.5 affects-7.1 affects-7.5 component/ddl This issue is related to DDL of TiDB. severity/major type/bug The issue is confirmed as a bug.

Comments

@SteveLeungYL
Copy link

Bug Report

1. Minimal reproduce step (Required)

  1. Compile the TiDB using the source repository: link
  2. Check out with the latest master version: 0c3bbc1, also tested with released version: v7.4.0-alpha (d43359a).
  3. Compile the TiDB server using go1.21.0. Use make in the repo root directory.
  4. Launch TiDB server using command:
./tidb-server -P 8000 -socket /tmp/mysql_0.sql -path $(pwd)/db_data
  1. Connect to the server using mysql client:
mysql -h 127.0.0.1 -P 8000 -u root --socket /tmp/mysql_0.sql
  1. Input the PoC Query to trigger the crash of the server.
RECOVER TABLE BY JOB 0;

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

The TiDB Server should continue running and report that the table does not exist.

3. What did you see instead (Required)

The TiDB-server crashes and then returns error:

mysql> RECOVER TABLE BY JOB 0;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

Here is a more detailed stack trace from the v7.4.0-alpha (d43359a):

github.com/pingcap/tidb/server.(*clientConn).Run.func1
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/conn.go:966
runtime.gopanic
\t/usr/local/go/src/runtime/panic.go:914
github.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/adapter.go:467
runtime.gopanic
\t/usr/local/go/src/runtime/panic.go:914
runtime.panicmem
\t/usr/local/go/src/runtime/panic.go:261
runtime.sigpanic
\t/usr/local/go/src/runtime/signal_unix.go:861
github.com/pingcap/tidb/executor.(*DDLExec).getRecoverTableByTableName
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/ddl.go:492
github.com/pingcap/tidb/executor.(*DDLExec).executeRecoverTable
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/ddl.go:399
github.com/pingcap/tidb/executor.(*DDLExec).Next
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/ddl.go:174
github.com/pingcap/tidb/executor.Next
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/executor.go:253
github.com/pingcap/tidb/executor.(*ExecStmt).next
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/adapter.go:1223
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/adapter.go:968
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/adapter.go:794
github.com/pingcap/tidb/executor.(*ExecStmt).Exec
\t/home/tidb/go_projects/src/github.com/tidb/tidb/executor/adapter.go:575
github.com/pingcap/tidb/session.runStmt
\t/home/tidb/go_projects/src/github.com/tidb/tidb/session/session.go:2435
github.com/pingcap/tidb/session.(*session).ExecuteStmt
\t/home/tidb/go_projects/src/github.com/tidb/tidb/session/session.go:2285
github.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/driver_tidb.go:291
github.com/pingcap/tidb/server.(*clientConn).handleStmt
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/conn.go:1994
github.com/pingcap/tidb/server.(*clientConn).handleQuery
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/conn.go:1785
github.com/pingcap/tidb/server.(*clientConn).dispatch
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/conn.go:1272
github.com/pingcap/tidb/server.(*clientConn).Run
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/conn.go:1051
github.com/pingcap/tidb/server.(*Server).onConn
\t/home/tidb/go_projects/src/github.com/tidb/tidb/server/server.go:699

4. What is your TiDB version? (Required)


+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                         |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.4.0-alpha
Edition: Community
Git Commit Hash: d43359a5570590d4892332ad0ad4b152cb12b3e1
Git Branch: HEAD
UTC Build Time: 2023-08-22 00:45:58
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@SteveLeungYL SteveLeungYL added the type/bug The issue is confirmed as a bug. label Aug 22, 2023
@jiyfhust
Copy link
Contributor

/assign

@jebter jebter added severity/major component/ddl This issue is related to DDL of TiDB. labels Aug 22, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. 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 labels Aug 22, 2023
@Defined2014 Defined2014 added affects-6.1 affects-6.5 affects-7.1 and removed may-affects-5.2 This bug maybe affects 5.2.x versions. 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 labels Oct 30, 2023
@Benjamin2037
Copy link
Collaborator

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 affects-6.5 affects-7.1 affects-7.5 component/ddl This issue is related to DDL of TiDB. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants