Unable to terminate session

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

Original topic: session杀不掉

| username: magongyong

[TiDB Usage Environment] Production Environment
[TiDB Version] 5.4.3
[Reproduction Path] Operations that led to the issue
A developer mistakenly executed a select statement, and the DBA couldn’t kill the session. The session is connected to the backend TiFlash through the TiDB server.

[Encountered Issue: Symptoms and Impact]
Killing the TiDB ID had no effect.

[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

| username: 胡杨树旁 | Original post link

To kill a session, you need to log in to the corresponding server and execute kill tidb ****.

| username: magongyong | Original post link

The logged-in session is on the TiDB server, and I am checking the information_schema.processlist.

| username: magongyong | Original post link

The SQL is still running, TiFlash has a high load, and it can’t be killed, so we can only wait. Accidentally querying the entire large table and not being able to kill it is simply disastrous.

| username: weixiaobing | Original post link

If possible, you can restart the TiDB server.

| username: magongyong | Original post link

The business is running in production, and the impact of a restart is too significant. It’s better to wait.

| username: magongyong | Original post link

Image

| username: 胡杨树旁 | Original post link

Can other sessions be killed normally? Is it just this one that can’t be killed?

| username: magongyong | Original post link

Based on past operational experience, it can all be terminated.

| username: magongyong | Original post link

I don’t know if it’s because using TiFlash to query a large table, but no matter how I try to kill it, it won’t stop.

| username: magongyong | Original post link

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

How many TiFlash nodes are you using? Can you check if there are still processes running on the TiFlash nodes?

| username: magongyong | Original post link

The run has been completed, and the TiFlash service process is normal. Thank you, everyone.

| username: xfworld | Original post link

How long did it run before being killed?

| username: magongyong | Original post link

It took nearly two hours, and it was actually resolved by killing the SQL client’s process with kill -9.

| username: tidb狂热爱好者 | Original post link

Production and R&D cannot be mixed.

| username: magongyong | Original post link

Normally, it’s like that, but our situation is a bit special. :joy:

| username: dba-kit | Original post link

Are you only querying TiFlash? Have you added TiFlash replicas for all tables?

| username: TiDBer_pkQ5q1l0 | Original post link

I also encountered a situation where killing TiDB didn’t work before, and later resolved it by restarting the tidb-server.

| username: magongyong | Original post link

Aggregate queries using TiFlash are generally for pages. This time, the R&D team wanted to try pagination queries but forgot to add WHERE and LIMIT.