How to resolve deadlock issues when the process cannot be killed

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

Original topic: 出现死锁问题怎么解决,进程一直kill不掉

| username: TiDBer_RSav8Cg3

【TiDB Usage Environment】Production Environment / Testing / PoC
【TiDB Version】
【Reproduction Path】What operations were performed when the issue occurred
【Encountered Issue: Problem Symptoms and Impact】
【Resource Configuration】
【Attachments: Screenshots / Logs / Monitoring】

| username: zhanggame1 | Original post link

Are you asking if you should kill TiDB XXXXX?

| username: TiDBer_RSav8Cg3 | Original post link

kill pid

| username: caiyfc | Original post link

In TiDB, a deadlock will immediately kill the second transaction, right? Your SQL is TRUNCATE, which is a DDL. To cancel a DDL, you need to use ADMIN CANCEL DDL: ADMIN CANCEL DDL | PingCAP Documentation Center

| username: TiDBer_RSav8Cg3 | Original post link

Is this successful? But I still see the process running.

| username: zhanggame1 | Original post link

TRUNCATE is generally very fast and shouldn’t get stuck.

| username: caiyfc | Original post link

The prompt indicates that this job has already been completed. Check the job status to confirm if it still exists.

| username: caiyfc | Original post link

Yes, essentially it drops and then creates a new table. The reason for the slowness requires additional information for analysis.

| username: TiDBer_RSav8Cg3 | Original post link

There are still

| username: caiyfc | Original post link

Looking at the information, there is no end time, and it indeed feels incomplete, but the status is “done.” There is no explanation for the “done” status in the documentation, so I am not sure what the situation is.

| username: Kongdom | Original post link

:astonished: “TRUNCATE TABLE” is actually a DDL statement, this is really the first time I’ve discovered this.

| username: tidb菜鸟一只 | Original post link

Why are the truncate table operations for the two identical tables still in the cancelling state? They haven’t been cancelled, right?

| username: h5n1 | Original post link

The DDL being stuck probably requires restarting all TiDB servers.

| username: xfworld | Original post link

Which version is more reliable? If DDL gets stuck, restarting all TiDB nodes can restore it…

| username: h5n1 | Original post link

Sorry, I can’t translate the content from the image. Please provide the text you need translated.

| username: Kongdom | Original post link

:astonished: Do you need to restart all TiDB nodes if DDL gets stuck? Has anyone tried this?

| username: h5n1 | Original post link

Yes, even cutting the leader doesn’t work.

| username: redgame | Original post link

Can’t kill it, restart.

| username: Hacker007 | Original post link

It’s “kill tidb pid,” not “kill pid.”

| username: TiDB_C罗 | Original post link

Is there another transaction using this table?