Kill Task, Task Cannot Be Terminated

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: kill 任务,任务无法杀死

| username: TiDBer_vFs1A6CZ

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.5.1
[Reproduction Path] Allocate 100G of running memory, assign a task that uses more than 100G of memory
[Encountered Problem: Problem Phenomenon and Impact] Observed that memory usage exceeds allocated memory and occupies disk space. Currently need to kill the running task, but kill id is ineffective.

[Resource Configuration]

[Attachments: Screenshots/Logs/Monitoring]

| username: WalterWj | Original post link

Try this: KILL | PingCAP 文档中心
kill tidb id;

| username: 随缘天空 | Original post link

Try executing the following SQL to query the ID, and then execute KILL id:
SELECT ID, USER, INSTANCE, INFO FROM INFORMATION_SCHEMA.CLUSTER_PROCESSLIST;

| username: dba远航 | Original post link

Try killing the TiDB ID.

| username: 小糊涂萌新 | Original post link

kill tidb id

| username: Jellybean | Original post link

Since TiDB has multiple compute layer nodes, if the global kill feature is not enabled, you won’t be able to terminate the connection if the node where the connection resides is different from the node where the kill command is executed.

Therefore, confirm whether the global kill feature is enabled. If not, you can enable it and then execute the kill command. From my impression, your version should support this feature.

Another way is to find the node where the connection resides, then log in to that node and execute the kill command. This method is supported in any version, as mentioned by the expert above.

| username: zhanggame1 | Original post link

TiDB has added the Global Kill feature since v6.1.0, so if you are not upgrading from a lower version, version 6.5 should be fine.

| username: Jellybean | Original post link

That’s right, if the global kill feature is correctly enabled, the phenomenon mentioned by the original poster should not occur.

| username: 人如其名 | Original post link

For version 6.5, many monitoring points have been added for the kill command, and most common cases can be handled. However, some disk write behaviors have not been well addressed.
Reference: 非并行hashAgg数据落盘读取阶段kill当前语句不生效 - TiDB 的问答社区

Therefore, it is recommended to test with the latest patches, such as version 6.5.5 or 7.5, to see if this mechanism has been further improved.

| username: TiDBer_vFs1A6CZ | Original post link

Yes, this task exceeds the memory and occupies part of the disk space.

| username: 像风一样的男子 | Original post link

I have encountered this as well. The process couldn’t be killed, and I had to restart TiDB.

| username: come_true | Original post link

Try executing it in the local command line connection tool.

| username: forever | Original post link

The most fundamental solution is to restart the tidb-server.

| username: 普罗米修斯 | Original post link

Kill the TiDB connection node ID, and after executing it, use show processlist. If it doesn’t work, wait a while and check again. I have encountered situations where the process disappeared after some time. If it still doesn’t work, you can only restart the TiDB server.

| username: xingzhenxiang | Original post link

kill tidb id

| username: TiDBer_小阿飞 | Original post link

Is this the ID at the TiDB layer? Shouldn’t it be killed at the system level?

| username: TiDBer_vFs1A6CZ | Original post link

Confirmed that the global kill feature is enabled, but there is a situation where tasks occupying the disk are killed. There is no good solution, so the tidb-server was restarted.

| username: TiDBer_CQ | Original post link

If you can’t kill it, usually the service instance will be restarted. I want to understand this layer clearly.