pt-kill --execute-command creates zombies

Bug #919819 reported by Baron Schwartz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
High
Daniel Nichter

Bug Description

Children are not waited for, so they become zombies:

3726 if ( $o->get('execute-command') ) {
3727 exec_cmd($o->get('execute-command'));
3728 msg('Executed ' . $o->get('execute-command'));
3729 }

And

3785 # Forks and detaches from parent to execute the given command;
3786 # does not block parent.
3787 sub exec_cmd {
3788 my ( $cmd ) = @_;
3789 PTDEBUG && _d('exec cmd:', $cmd);
3790 return unless $cmd;
3791
3792 my $pid = fork();
3793 if ( $pid ) {
3794 # parent
3795 PTDEBUG && _d('child pid:', $pid);
3796 return $pid;
3797 }
3798
3799 # child
3800 POSIX::setsid() or die "Cannot start a new session: $OS_ERROR";
3801 my $retval = system($cmd);
3802 $retval = $retval >> 8;
3803 PTDEBUG && _d('child exit status:', $retval);
3804 exit $retval;
3805 }

We need a waitpid() to reap the child processes that have terminated. The workaround is to stop and restart the entire process.

tags: added: percona-21182 zombies
removed: zombie
Changed in percona-toolkit:
assignee: Brian Fraser (fraserbn) → Daniel Nichter (daniel-nichter)
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

pt-kill doesn't care about the processes it executes for the user. So instead of waitpid(), we can simply ignore dead children and let the system auto-reap them.

summary: - pt-kill creates zombies when it kills things
+ pt-kill --execute-command creates zombies
Changed in percona-toolkit:
status: Confirmed → Fix Committed
Changed in percona-toolkit:
status: Fix Committed → Fix Released
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-291

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.