Skip to content

TiDB server crashes when running EXPLAIN statement #45957

@SteveLeungYL

Description

@SteveLeungYL

Bug Report

1. Minimal reproduce step (Required)

  1. Compile the TiDB using the source repository: link
  2. Check out with the latest master version: 54fde485a7c4, also tested with released version: v7.1.1(cf44157).
  3. Compile the TiDB server using go1.20 or 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.
EXPLAIN FORMAT = TRADITIONAL ((VALUES ROW ()) ORDER BY 1);

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

The TiDB Server should continue running.

3. What did you see instead (Required)

The TiDB crashes and then returns error:

mysql> EXPLAIN FORMAT = TRADITIONAL ((VALUES ROW ()) ORDER BY 1);
ERROR 1105 (HY000): runtime error: slice bounds out of range [-1:]

4. What is your TiDB version? (Required)

+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.1.1
Edition: Community
Git Commit Hash: cf44157
Git Branch: HEAD
UTC Build Time: 2023-08-06 19:14:34
GoVersion: go1.20
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions