pt-kill --execute-command creates zombies
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(
3727 exec_cmd(
3728 msg('Executed ' . $o->get(
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.
Related branches
tags: |
added: percona-21182 zombies removed: zombie |
Changed in percona-toolkit: | |
assignee: | Brian Fraser (fraserbn) → Daniel Nichter (daniel-nichter) |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
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.