pt-kill seems to ignore options

I’m not sure if I’m using it wrong, but right now I’m using pt-kill 3.2.0 with MariaDB 10.3.23 on Ubuntu and it seems to indiscriminately kill any running query. Here’s what I’m using from the command line, the goal is to kill queries run by ‘username’ that have been running for at least 5 minutes:

/usr/bin/pt-kill --busy-time 300 --match-user username --kill --print --pid=/var/run/ptkill.pid --interval=5 --defaults-file=/root/.my.cnf --log=/var/log/ptkill.log

And here’s an example of the output I’m getting:

# 2020-06-26T18:01:24 KILL 18754 (Sleep 0 sec) NULL<br># 2020-06-26T18:01:29 KILL 18785 (Sleep 0 sec) NULL<br># 2020-06-26T18:01:34 KILL 18800 (Sleep 2 sec) NULL<br># 2020-06-26T18:01:39 KILL 18809 (Sleep 6 sec) NULL<br># 2020-06-26T18:01:44 KILL 18808 (Sleep 11 sec) NULL<br># 2020-06-26T18:01:49 KILL 18807 (Sleep 16 sec) NULL<br># 2020-06-26T18:01:54 KILL 18846 (Sleep 18 sec) NULL<br># 2020-06-26T18:01:59 KILL 18864 (Sleep 20 sec) NULL<br># 2020-06-26T18:02:04 KILL 19009 (Sleep 0 sec) NULL<br># 2020-06-26T18:02:09 KILL 19053 (Execute 0 sec) select s.source from report_sources s where s.profile_id = '184' and s.profile_type = '2' and s.report_type = 5 and s.date_frequency = 'FY'<br># 2020-06-26T18:02:34 KILL 19177 (Sleep 3 sec) NULL<br># 2020-06-26T18:02:49 KILL 19275 (Sleep 1 sec) NULL<br># 2020-06-26T18:02:59 KILL 19358 (Sleep 0 sec) NULL<br># 2020-06-26T18:03:04 KILL 19373 (Sleep 0 sec) NULL<br># 2020-06-26T18:03:09 KILL 19416 (Sleep 2 sec) NULL<br># 2020-06-26T18:03:49 KILL 19599 (Sleep 8 sec) NULL<br># 2020-06-26T18:03:54 KILL 19729 (Sleep 2 sec) NULL<br># 2020-06-26T18:03:59 KILL 19759 (Sleep 0 sec) NULL<br># 2020-06-26T18:04:04 KILL 19772 (Sleep 0 sec) NULL<br># 2020-06-26T18:04:24 KILL 19880 (Sleep 5 sec) NULL<br># 2020-06-26T18:04:29 KILL 19879 (Sleep 10 sec) NULL<br># 2020-06-26T18:07:09 KILL 21478 (Prepare 0 sec) select s.id as tokenId from sessions s join clients c on s.clientid = c.id where s.id != unhex(?) and userid = (?) and c.identifier = (?) and s.expires &gt; now() and c.enabled = 1

Am I missing something obvious or is pt-kill definitely not working as expected here?

Hi,
I think this is happening due to the match on

--match-user username

you are using. From the docs:
pt-kill will kill all the queries matching ANY of the specified criteria (logical OR). For example, using:
–busy-time 114 --match-command ‘Query|Execute’
will kill all queries having busy-time > 114 OR where the command is Query or Execute

This is why you will get queries in Sleep for only one second to be killed, because they are matching the user.