TiDB server crashes when running `ADMIN` statement
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
### 1. Minimal reproduce step (Required)
1. Compile the TiDB using the source repository: [link](https://github.com/pingcap/tidb)
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:
```bash
./tidb-server -P 8000 -socket /tmp/mysql_0.sql -path $(pwd)/db_data
```
5. Connect to the server using mysql client:
```bash
mysql -h 127.0.0.1 -P 8000 -u root --socket /tmp/mysql_0.sql
```
6. Input the PoC Query to trigger the crash of the server.
```sql
ADMIN SHOW DDL JOBS WHERE TRUE IN (SELECT TRUE) < ALL (SELECT TRUE);
```
### 2. What did you expect to see? (Required)
The TiDB server should return all the DDL JOBS running on the server.
### 3. What did you see instead (Required)
The TiDB crashes and then return error:
```
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id: 413
Current database: *** NONE ***
ERROR 1105 (HY000): runtime error: index out of range [-1]
```
### 4. What is your TiDB version? (Required)
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.1.1
Edition: Community
Git Commit Hash: cf441574864be63938524e7dfcf7cc659edc3dd8
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 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Contributor guide
Assessment
This issue has not been assessed yet.