pt-kill not killing connections when execute-command is set

Bug #1460354 reported by Tom Krouper
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Confirmed
Undecided
Unassigned

Bug Description

While testing pt-kill I discovered that for some reason, it appears that the "execute-command" is causing the "kill" option to fail. Simple remove the execute-command option and everything works as expected. Below is an example I created to test. and show the issue.

Configuration: .pt-kill.conf
busy-time=30s
log=/root/pt_kill.log
pid=/root/pt_kill.pid
execute-command=(date >> /root/execute.log)
match-info=^SELECT
kill
print

MySQL Version:
mysqld Ver 5.6.24-72.2 for Linux on x86_64 (Percona Server (GPL), Release 72.2, Revision 8d0f85b)

Percona Toolkit Version:
pt-kill 2.2.14

Queries run and output:
[root@tslls ~]# date; mysql --comments -e "SELECT @@server_id, SLEEP(65) /* First Query */;"; date
Sat May 30 23:10:28 UTC 2015
ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query
Sat May 30 23:11:02 UTC 2015
[root@tslls ~]# date; mysql --comments -e "SELECT @@server_id, SLEEP(65) /* Second Query */;"; date
Sat May 30 23:11:43 UTC 2015
+-------------+-----------+
| @@server_id | SLEEP(65) |
+-------------+-----------+
| 0 | 0 |
+-------------+-----------+
Sat May 30 23:12:48 UTC 2015
[root@tslls ~]# touch /tmp/pt-kill-sentinel

execute-command output:
[root@tslls ~]# cat execute.log
Sat May 30 23:11:02 UTC 2015
Sat May 30 23:12:20 UTC 2015
Sat May 30 23:12:39 UTC 2015

Tags: pt-kill
Revision history for this message
Tom Krouper (b-tk) wrote :
Revision history for this message
Tom Krouper (b-tk) wrote :
Revision history for this message
Gillian Gunson (ggunson) wrote :

I was able to repeat this using Tom's test case. It looks like pt-kill will succeed on killing the first query, but all subsequent queries it will fail to kill on "MySQL server has gone away" at /usr/bin/pt-kill line 6806. And it looks like it won't reestablish the database connection until the next "SHOW FULL PROCESSLIST" fails after the two failed kill attempts.

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

Verified with 2.2.14.

nilnandan@desktop:~$ pt-show-grants --version
pt-show-grants 2.2.14
nilnandan@desktop:~$

nilnandan@desktop:~$ cat .pt-kill.conf
busy-time=30s
log=/home/nilnandan/pt_kill.log
pid=/home/nilnandan/pt_kill.pid
execute-command=(date >> /home/nilnandan/execute.log)
match-info=^SELECT
kill
print
nilnandan@desktop:~$

nilnandan@desktop:~$ date; mysql --comments -e "SELECT @@server_id, SLEEP(65) /* First Query */;"; date
Mon Jun 1 15:22:02 IST 2015
ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query
Mon Jun 1 15:22:33 IST 2015
nilnandan@desktop:~$

nilnandan@desktop:~$ cat .pt-kill.conf
busy-time=30s
log=/home/nilnandan/pt_kill.log
pid=/home/nilnandan/pt_kill.pid
#execute-command=(date >> /home/nilnandan/execute.log)
match-info=^SELECT
kill
print
nilnandan@desktop:~$ date; mysql --comments -e "SELECT @@server_id, SLEEP(65) /* First Query */;"; date
Mon Jun 1 15:23:45 IST 2015
+-------------+-----------+
| @@server_id | SLEEP(65) |
+-------------+-----------+
| 10000 | 0 |
+-------------+-----------+
Mon Jun 1 15:24:50 IST 2015
nilnandan@desktop:~$
nilnandan@desktop:~$ cat execute.log
Mon Jun 1 15:22:33 IST 2015
Mon Jun 1 15:24:40 IST 2015
nilnandan@desktop:~$

Changed in percona-toolkit:
status: New → Confirmed
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1285

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.