KILL QUERY does not terminate long running query; query remains in CLUSTER_PROCESSLIST
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
We encountering an issue where a long running query remained active in TiDB even after attempting to terminate it.
### 1. Minimal reproduce step (Required)
1. Connect to the TiDB cluster.
2. Identify a long running query from:
SELECT * FROM information_schema.cluster_processlist;
3. Note the QUERY_ID of the long running query.
4. Execute:
KILL ;
5. Verify the query status using:
SELECT * FROM information_schema.cluster_processlist WHERE ID = ;
6. The query continues to appear in cluster_processlist even after KILL QUERY.
7. We also observed an expensive_query log entry for the same query, with the execution time continuing to increase.
8. The corresponding record in information_schema.cluster_slow_query showed:
succ = 0
9. Rechecking cluster_processlist continued to show the query as running.
### 2. What did you expect to see?
After executing KILL , the running query should be cancelled and should no longer remain as an active query in information_schema.cluster_processlist.
The query execution should stop and its execution time should no longer continue to increase.
### 3. What did you see instead
After executing KILL , the query continued to appear in information_schema.cluster_processlist.
The query execution time continued to increase.
At the same time, the TiDB log continued to show an expensive_query entry corresponding to the same query, indicating that the query was still consuming execution time.
The corresponding record in information_schema.cluster_slow_query showed succ = 0.
We would like to understand whether this behavior is expected for certain types of queries, or whether the query should have been cancelled completely after KILL QUERY.
We would also like to know whether there is any additional mechanism to forcefully terminate such a query when KILL QUERY does not remove it from cluster_processlist.
### 4. What is your TiDB version?
mysql> SELECT tidb_version() \G
*************************** 1. row ***************************
tidb_version(): Release Version: v8.5.3
Edition: Community
Git Commit Hash: dc2548aac79a712265e831cff2a3a896bc0a5a38
Git Branch: HEAD
UTC Build Time: 2025-07-31 13:54:43
GoVersion: go1.23.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
Contributor guide
Assessment
This issue has not been assessed yet.