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

MySQL server has gone away when use mysql client to connect TiDB server. #4863

Closed
blacktear23 opened this issue Oct 23, 2017 · 9 comments
Closed
Assignees
Labels
component/statistics type/bug The issue is confirmed as a bug.

Comments

@blacktear23
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

Connect to TiDB use mysql command line tool, then use database and execute show tables;

  1. What did you expect to see?

List tables.

  1. What did you see instead?
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...

And tidb.log contains stack trace:

2017/10/23 11:47:02.948 server.go:138: [info] [5980] new connection 10.55.0.1:50338
2017/10/23 11:47:02.960 conn.go:388: [error] lastCmd bigdata_company_domain_map, runtime error: index out of range, goroutine 9019713 [running]:
github.com/pingcap/tidb/server.(*clientConn).Run.func1(0xc425e43ad0)
	/build/src/github.com/pingcap/tidb/server/conn.go:386 +0xfd
panic(0x1056740, 0x1a82680)
	/usr/local/go/src/runtime/panic.go:489 +0x2cf
github.com/pingcap/tidb/plan.(*DataSource).getStatsProfileByFilter(0xc42015f380, 0x0, 0x0, 0x0, 0x1)
	/build/src/github.com/pingcap/tidb/plan/stats.go:78 +0x325
github.com/pingcap/tidb/plan.(*DataSource).prepareStatsProfile(0xc42015f380, 0x18c6060)
	/build/src/github.com/pingcap/tidb/plan/stats.go:93 +0x53
github.com/pingcap/tidb/plan.(*Limit).prepareStatsProfile(0xc422458d70, 0x18c65a0)
	/build/src/github.com/pingcap/tidb/plan/stats.go:118 +0x72
github.com/pingcap/tidb/plan.(*Projection).prepareStatsProfile(0xc422458c80, 0x0)
	/build/src/github.com/pingcap/tidb/plan/stats.go:172 +0x83
github.com/pingcap/tidb/plan.dagPhysicalOptimize(0x18cbce0, 0xc422458c80, 0xc422458c01, 0x18b2c40, 0xc462159e00, 0xc42a68ff48)
	/build/src/github.com/pingcap/tidb/plan/optimizer.go:150 +0x4f
github.com/pingcap/tidb/plan.doOptimize(0x43, 0x18cbce0, 0xc422458c80, 0x18b2c40, 0xc462159e00, 0xc42a68ff48, 0x1, 0xc4202ab6c0, 0xc455b13800, 0xd26539)
	/build/src/github.com/pingcap/tidb/plan/optimizer.go:120 +0xdd
github.com/pingcap/tidb/plan.Optimize(0x18b2c40, 0xc462159e00, 0x18a7a20, 0xc45c6cf220, 0x7fb8a3be8d68, 0xc4215c0c00, 0x0, 0x0, 0x1, 0xc4225744e0)
	/build/src/github.com/pingcap/tidb/plan/optimizer.go:81 +0x223
github.com/pingcap/tidb/executor.(*Compiler).Compile(0xc455b13923, 0x18b2c40, 0xc462159e00, 0x18ab4e0, 0xc45c6cf220, 0x11dfa60, 0xf, 0xc4ba795b80)
	/build/src/github.com/pingcap/tidb/executor/compiler.go:40 +0x1ae
github.com/pingcap/tidb.(*session).Execute(0xc462159e00, 0xc421346c80, 0x32, 0x0, 0x3, 0xc421346c80, 0xc421346ca9, 0xc455b13bb0)
	/build/src/github.com/pingcap/tidb/session.go:724 +0x891
github.com/pingcap/tidb/server.(*TiDBContext).Execute(0xc44ee90c60, 0xc421346c80, 0x32, 0xc4202aae41, 0x1a, 0x11d70a4, 0x9, 0xc421346c80)
	/build/src/github.com/pingcap/tidb/server/driver_tidb.go:194 +0x62
github.com/pingcap/tidb/server.(*TiDBContext).FieldList(0xc44ee90c60, 0xc4202aae41, 0x1a, 0x1, 0xc4202aae80, 0x2, 0x2, 0xc421876418)
	/build/src/github.com/pingcap/tidb/server/driver_tidb.go:233 +0x8e
github.com/pingcap/tidb/server.(*clientConn).handleFieldList(0xc425e43ad0, 0xc4202aae41, 0x1b, 0x1aeec50, 0x1c)
	/build/src/github.com/pingcap/tidb/server/conn.go:758 +0xa6
github.com/pingcap/tidb/server.(*clientConn).dispatch(0xc425e43ad0, 0xc4202aae41, 0x1c, 0x1b, 0x0, 0x0)
	/build/src/github.com/pingcap/tidb/server/conn.go:528 +0x52f
github.com/pingcap/tidb/server.(*clientConn).Run(0xc425e43ad0)
	/build/src/github.com/pingcap/tidb/server/conn.go:409 +0x13c
github.com/pingcap/tidb/server.(*Server).onConn(0xc421876480, 0x18b0ac0, 0xc4213cc9a8)
	/build/src/github.com/pingcap/tidb/server/server.go:334 +0x18e
created by github.com/pingcap/tidb/server.(*Server).Run
	/build/src/github.com/pingcap/tidb/server/server.go:273 +0xc8

2017/10/23 11:47:02.960 server.go:309: [info] [5980] close connection
  1. What version of TiDB are you using (tidb-server -V)?

TiDB version is 1.0.0

@blacktear23
Copy link
Contributor Author

Follow the stack trace, found error code should be here:

image

@shenli
Copy link
Member

shenli commented Oct 23, 2017

@blacktear23 Thanks for your feedback! May I have your GitHash? You can get it by select tidb_version();.

@shenli
Copy link
Member

shenli commented Oct 23, 2017

@hanfei1991 @lamxTyler PTAL

@shenli shenli added type/bug The issue is confirmed as a bug. component/statistics labels Oct 23, 2017
@blacktear23
Copy link
Contributor Author

@shenli you can trace my fork's spcmaster branch. This is build by this branch. https://github.com/blacktear23/tidb/tree/spcmaster

@blacktear23
Copy link
Contributor Author

@shenli PR #4864 seems fix my production cluster.

@alivxxx
Copy link
Contributor

alivxxx commented Oct 23, 2017

@blacktear23 Seems that this problem is already fixed by #4825 , could you try it?

@blacktear23
Copy link
Contributor Author

@lamxTyler what about current data? Seems this PR only fix for insert on stat build. If I already have a built data in database, seems this problem should be reproduced.

@alivxxx
Copy link
Contributor

alivxxx commented Oct 23, 2017

@blacktear23 Yes, you are right.

@blacktear23
Copy link
Contributor Author

PR #4864 is merged so close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/statistics type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants