LP #923896: pt-kill: uninitialized value causes script to exit

Description

**Reported in Launchpad by Atle Veka last update 19-06-2012 20:02:36

pt-kill frequently, about once or twice daily, exits operation after encountering uninitialized variables. Script should properly check all processlist fields and skip execution if any of the fields it requires are "undef".

Debug output:

  1. Processlist:2161 28382 Checking query $VAR1 = {

  2. Command => 'Sleep',

  3. Host => '<FQDN>:<PORT>',

  4. Id => '182564144',

  5. Info => undef,

  6. State => undef,

  7. Time => undef,

  8. User => '<USER>',

  9. db => undef

  10. };
    #

  11. MasterSlave:2937 28382 Not system user

  12. MasterSlave:2954 28382 Matches all replication thread: no ; match: 0
    Use of uninitialized value in numeric lt (<) at /usr/local/bin/pt-kill line 2180.

In this case it is barfing on the "Time" field.

Line 2179: if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {
Line 2180: if ( $query->{Time} < $find_spec{idle_time} ) {

Thanks,
Atle

Environment

None

Smart Checklist

Activity

lpjirasync January 24, 2018 at 3:07 PM

**Comment from Launchpad by: Atle Veka on: 30-01-2012 22:20:35

I'm testing this modification.

  •  

    •  

      • pt-kill Mon Jan 30 14:16:28 2012

      • pt-kill.orig Mon Jan 23 14:22:32 2012
        ***************

      • 2176,2186 ****
        $matched++;
        }

  • if ( ! defined $query->{Time} ) {

  • PTDEBUG && _d('query->{Time} is undef, skipping query');

  • next QUERY;

  • }

  • if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {
    if ( $query->{Time} < $find_spec{idle_time} ) {
    PTDEBUG && _d("Query isn't idle long enough");

    •  

      • 2176,2181 ----

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 3:07 PM
Updated January 24, 2018 at 3:07 PM
Resolved January 24, 2018 at 3:07 PM