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

crash when truncate table in transcation #8127

Closed
lysu opened this issue Oct 31, 2018 · 2 comments
Closed

crash when truncate table in transcation #8127

lysu opened this issue Oct 31, 2018 · 2 comments
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@lysu
Copy link
Contributor

lysu commented Oct 31, 2018

Bug Report

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
mysql> create table ut(a int, primary key(a));
Query OK, 0 rows affected (0.04 sec)

mysql> insert into ut values (1);
Query OK, 1 row affected (0.00 sec)

mysql> begin;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into ut values (1);
Query OK, 1 row affected (0.01 sec)

mysql> truncate ut;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

  1. What did you expect to see?

should not crash

  1. What did you see instead?

process crashed with

2018/10/31 22:18:41.403 session.go:368: [warning] con:1 finished txn:{<nil> <nil> 0xc0083c8a60 map[] [] <nil>}, [kv:1062]Duplicate entry '1' for key 'PRIMARY'
2018/10/31 22:18:41.404 conn.go:427: [error] lastCmd truncate ut, runtime error: invalid memory address or nil pointer dereference, goroutine 1313 [running]:
github.com/pingcap/tidb/server.(*clientConn).Run.func1(0xc00806d860, 0xc000767bf0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/conn.go:425 +0xc2
panic(0x175ca40, 0x2a3abc0)
	/home/robi/go1.11.1/src/runtime/panic.go:513 +0x1e6
github.com/pingcap/tidb/executor.(*DDLExec).toErr(0xc009675180, 0x1c0cd60, 0xc0086d7f40, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/executor/ddl.go:57 +0x183
github.com/pingcap/tidb/executor.(*DDLExec).Next(0xc009675180, 0x7f067eafa0c0, 0xc008e5bfc0, 0xc008e80b40, 0x1c0cd60, 0xc0086d7f40)
	/home/robi/Code/go/src/github.com/pingcap/tidb/executor/ddl.go:94 +0x2d3
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor(0xc00a121f80, 0x7f067eafa0c0, 0xc008e5bfc0, 0x1c43600, 0xc0083c5ea0, 0x1c24d80, 0xc009675180, 0x0, 0x0, 0x0, ...)
	/home/robi/Code/go/src/github.com/pingcap/tidb/executor/adapter.go:270 +0x23d
github.com/pingcap/tidb/executor.(*ExecStmt).Exec(0xc00a121f80, 0x7f067eafa0c0, 0xc008e5bfc0, 0x0, 0x0, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/executor/adapter.go:234 +0xb10
github.com/pingcap/tidb/session.runStmt(0x7f067eafa0c0, 0xc008e5bfc0, 0x1c43600, 0xc0083c5ea0, 0x1c21500, 0xc00a121f80, 0x0, 0x0, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/session/tidb.go:148 +0xd0
github.com/pingcap/tidb/session.(*session).executeStatement(0xc0083c5ea0, 0x7f067eafa0c0, 0xc008e5bfc0, 0x1, 0x1c201c0, 0xc0086d7880, 0x1c21500, 0xc00a121f80, 0x0, 0x0, ...)
	/home/robi/Code/go/src/github.com/pingcap/tidb/session/session.go:734 +0x24d
github.com/pingcap/tidb/session.(*session).execute(0xc0083c5ea0, 0x7f067eafa0c0, 0xc008e5bfc0, 0xc00976c7c1, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/session/session.go:805 +0xf1d
github.com/pingcap/tidb/session.(*session).Execute(0xc0083c5ea0, 0x7f067eafa0c0, 0xc008e5bfc0, 0xc00976c7c1, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/session/session.go:755 +0xa4
github.com/pingcap/tidb/server.(*TiDBContext).Execute(0xc0083ee450, 0x7f067eafa0c0, 0xc008e5bfc0, 0xc00976c7c1, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/driver_tidb.go:239 +0xc4
github.com/pingcap/tidb/server.(*clientConn).handleQuery(0xc00806d860, 0x7f067eafa0c0, 0xc008e5bfc0, 0xc00976c7c1, 0xb, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/conn.go:874 +0xb7
github.com/pingcap/tidb/server.(*clientConn).dispatch(0xc00806d860, 0xc00976c7c1, 0xb, 0xb, 0x0, 0x0)
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/conn.go:626 +0x88d
github.com/pingcap/tidb/server.(*clientConn).Run(0xc00806d860)
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/conn.go:470 +0x458
github.com/pingcap/tidb/server.(*Server).onConn(0xc0071324e0, 0x1c29220, 0xc007a3b958)
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/server.go:324 +0x3b4
created by github.com/pingcap/tidb/server.(*Server).Run
	/home/robi/Code/go/src/github.com/pingcap/tidb/server/server.go:264 +0x7e1

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: None
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: None
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)
@lysu lysu added type/bug The issue is confirmed as a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Oct 31, 2018
@lysu lysu self-assigned this Oct 31, 2018
@lysu lysu changed the title panic when truncate table in transcation crash when truncate table in transcation Oct 31, 2018
@zz-jason
Copy link
Member

already fixed in: #8056

@lysu
Copy link
Contributor Author

lysu commented Oct 31, 2018

ok, we meet same question...2333

@lysu lysu closed this as completed Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants