Alternative way to kill a zombie process












17














I just noticed some zombie processes on CentOS 6.8(Final), tried to kill them but they are still there:



[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 20776 20669 0 09:03 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>

[root@host user]# kill 746 747 29970 29971

[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 21525 20669 0 09:26 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>


As you can see they are running for two months, and too if they are not harmful I would get rid of them, any alternative way to kill a Zombie?










share|improve this question




















  • 1




    have you tried kill -9?
    – Ipor Sircer
    Sep 19 '16 at 7:35






  • 7




    Only 747 and 29971 are zombie processes. The others might be locked up but they're not dead yet.
    – roaima
    Sep 19 '16 at 9:28










  • Seems you have a bug in some code running on tomcat...
    – Boris the Spider
    Sep 19 '16 at 10:41






  • 5




    Zombies - what are they?
    – sds
    Sep 19 '16 at 16:49
















17














I just noticed some zombie processes on CentOS 6.8(Final), tried to kill them but they are still there:



[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 20776 20669 0 09:03 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>

[root@host user]# kill 746 747 29970 29971

[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 21525 20669 0 09:26 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>


As you can see they are running for two months, and too if they are not harmful I would get rid of them, any alternative way to kill a Zombie?










share|improve this question




















  • 1




    have you tried kill -9?
    – Ipor Sircer
    Sep 19 '16 at 7:35






  • 7




    Only 747 and 29971 are zombie processes. The others might be locked up but they're not dead yet.
    – roaima
    Sep 19 '16 at 9:28










  • Seems you have a bug in some code running on tomcat...
    – Boris the Spider
    Sep 19 '16 at 10:41






  • 5




    Zombies - what are they?
    – sds
    Sep 19 '16 at 16:49














17












17








17


1





I just noticed some zombie processes on CentOS 6.8(Final), tried to kill them but they are still there:



[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 20776 20669 0 09:03 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>

[root@host user]# kill 746 747 29970 29971

[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 21525 20669 0 09:26 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>


As you can see they are running for two months, and too if they are not harmful I would get rid of them, any alternative way to kill a Zombie?










share|improve this question















I just noticed some zombie processes on CentOS 6.8(Final), tried to kill them but they are still there:



[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 20776 20669 0 09:03 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>

[root@host user]# kill 746 747 29970 29971

[root@host user]# ps -ef | grep git
tomcat 746 1 0 Jul18 ? 00:00:00 git clone https://github.com/angular/bower-angular.git -b v1.3.20 --progress . --depth 1
tomcat 747 746 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>
root 21525 20669 0 09:26 pts/3 00:00:00 grep git
tomcat 29970 1 0 Jul18 ? 00:00:00 git clone https://github.com/components/jqueryui.git -b 1.12.0 --progress . --depth 1
tomcat 29971 29970 0 Jul18 ? 00:00:00 [git-remote-http] <defunct>


As you can see they are running for two months, and too if they are not harmful I would get rid of them, any alternative way to kill a Zombie?







process kill






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 20 '16 at 7:31

























asked Sep 19 '16 at 7:30









lese

2,12031327




2,12031327








  • 1




    have you tried kill -9?
    – Ipor Sircer
    Sep 19 '16 at 7:35






  • 7




    Only 747 and 29971 are zombie processes. The others might be locked up but they're not dead yet.
    – roaima
    Sep 19 '16 at 9:28










  • Seems you have a bug in some code running on tomcat...
    – Boris the Spider
    Sep 19 '16 at 10:41






  • 5




    Zombies - what are they?
    – sds
    Sep 19 '16 at 16:49














  • 1




    have you tried kill -9?
    – Ipor Sircer
    Sep 19 '16 at 7:35






  • 7




    Only 747 and 29971 are zombie processes. The others might be locked up but they're not dead yet.
    – roaima
    Sep 19 '16 at 9:28










  • Seems you have a bug in some code running on tomcat...
    – Boris the Spider
    Sep 19 '16 at 10:41






  • 5




    Zombies - what are they?
    – sds
    Sep 19 '16 at 16:49








1




1




have you tried kill -9?
– Ipor Sircer
Sep 19 '16 at 7:35




have you tried kill -9?
– Ipor Sircer
Sep 19 '16 at 7:35




7




7




Only 747 and 29971 are zombie processes. The others might be locked up but they're not dead yet.
– roaima
Sep 19 '16 at 9:28




Only 747 and 29971 are zombie processes. The others might be locked up but they're not dead yet.
– roaima
Sep 19 '16 at 9:28












Seems you have a bug in some code running on tomcat...
– Boris the Spider
Sep 19 '16 at 10:41




Seems you have a bug in some code running on tomcat...
– Boris the Spider
Sep 19 '16 at 10:41




5




5




Zombies - what are they?
– sds
Sep 19 '16 at 16:49




Zombies - what are they?
– sds
Sep 19 '16 at 16:49










4 Answers
4






active

oldest

votes


















6














As mentioned by Heemayl, you cannot actually kill a zombie. It's already [un]dead...



However, the problem you are facing looks like a problem with the git clone command. It gets stuck somehow. Probably times out or fails in some other way? It is often because of some I/O that a process gets stuck to the point where a SIGTERM and SIGINT won't work.



To kill it, in this case, you want to use the -9 command line option. This means send the SIGKILL signal. You can actually use -KILL too.



[root@host user]# kill -KILL 746 29970


To get a list of available signals, use the list command line option.



[root@host user]# kill -l


This shows you the numbers and names (and you'll see that #9 says SIGKILL.)






share|improve this answer



















  • 1




    Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
    – lese
    Sep 21 '16 at 10:02



















38














You can't kill a Zombie (process), it is already dead. It is just waiting for its parent process to do wait(2) and collect its exit status. It won't take any resource on the system other than a process table entry.



You can send SIGCHLD to its parent to let it know that one of its children has terminated (i.e. request it to collect child's exit status). This signal can be ignored (which is the default):



kill -CHLD <PPID>


(Replace <PPID> with the actual PID of the parent.)



Or you can kill the parent process so that init (PID 1) will inherit the zombie process and reap it properly (it's one of init's main tasks to inherit any orphan and do wait(2) regularly). But killing the parent is not recommended. Generally, creation of zombie processes indicates programming issue/issues, and you should try to fix or report that instead.






share|improve this answer



















  • 8




    You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
    – Andrew Henle
    Sep 19 '16 at 10:43






  • 1




    @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
    – R..
    Sep 19 '16 at 16:36










  • @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
    – Andrew Henle
    Sep 19 '16 at 20:50






  • 1




    @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
    – Alexis Wilke
    Sep 20 '16 at 0:58










  • It can't hurt, but I wouldn't put odds on it working.
    – Barmar
    Sep 22 '16 at 1:26



















1














to look for zombie processes:



ps aux | grep -w Z | grep -v grep

ps -eo stat,ppid | grep -w Z


to kill zombie process, the parent IDs need to be killed ie PPID:



kill PPID1 PPID2

kill $(ps -eo stat,ppid|grep -w Z|awk '{print $2}'|tr "n" " ")





share|improve this answer































    0














    When a parent process dies, all zombie process will get cleaned up.
    Don’t kill parent process just to clean up zombie process. It will come again when you re-run your program.
    Fix your program with properly calling “wait ()” or “waitpid ()” system call.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f310768%2falternative-way-to-kill-a-zombie-process%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      As mentioned by Heemayl, you cannot actually kill a zombie. It's already [un]dead...



      However, the problem you are facing looks like a problem with the git clone command. It gets stuck somehow. Probably times out or fails in some other way? It is often because of some I/O that a process gets stuck to the point where a SIGTERM and SIGINT won't work.



      To kill it, in this case, you want to use the -9 command line option. This means send the SIGKILL signal. You can actually use -KILL too.



      [root@host user]# kill -KILL 746 29970


      To get a list of available signals, use the list command line option.



      [root@host user]# kill -l


      This shows you the numbers and names (and you'll see that #9 says SIGKILL.)






      share|improve this answer



















      • 1




        Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
        – lese
        Sep 21 '16 at 10:02
















      6














      As mentioned by Heemayl, you cannot actually kill a zombie. It's already [un]dead...



      However, the problem you are facing looks like a problem with the git clone command. It gets stuck somehow. Probably times out or fails in some other way? It is often because of some I/O that a process gets stuck to the point where a SIGTERM and SIGINT won't work.



      To kill it, in this case, you want to use the -9 command line option. This means send the SIGKILL signal. You can actually use -KILL too.



      [root@host user]# kill -KILL 746 29970


      To get a list of available signals, use the list command line option.



      [root@host user]# kill -l


      This shows you the numbers and names (and you'll see that #9 says SIGKILL.)






      share|improve this answer



















      • 1




        Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
        – lese
        Sep 21 '16 at 10:02














      6












      6








      6






      As mentioned by Heemayl, you cannot actually kill a zombie. It's already [un]dead...



      However, the problem you are facing looks like a problem with the git clone command. It gets stuck somehow. Probably times out or fails in some other way? It is often because of some I/O that a process gets stuck to the point where a SIGTERM and SIGINT won't work.



      To kill it, in this case, you want to use the -9 command line option. This means send the SIGKILL signal. You can actually use -KILL too.



      [root@host user]# kill -KILL 746 29970


      To get a list of available signals, use the list command line option.



      [root@host user]# kill -l


      This shows you the numbers and names (and you'll see that #9 says SIGKILL.)






      share|improve this answer














      As mentioned by Heemayl, you cannot actually kill a zombie. It's already [un]dead...



      However, the problem you are facing looks like a problem with the git clone command. It gets stuck somehow. Probably times out or fails in some other way? It is often because of some I/O that a process gets stuck to the point where a SIGTERM and SIGINT won't work.



      To kill it, in this case, you want to use the -9 command line option. This means send the SIGKILL signal. You can actually use -KILL too.



      [root@host user]# kill -KILL 746 29970


      To get a list of available signals, use the list command line option.



      [root@host user]# kill -l


      This shows you the numbers and names (and you'll see that #9 says SIGKILL.)







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Dec 24 '18 at 22:51

























      answered Sep 20 '16 at 1:03









      Alexis Wilke

      949615




      949615








      • 1




        Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
        – lese
        Sep 21 '16 at 10:02














      • 1




        Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
        – lese
        Sep 21 '16 at 10:02








      1




      1




      Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
      – lese
      Sep 21 '16 at 10:02




      Actually kill -KILL was the only command able to close these processes, for this reason I'am going to accept @Alexis Wilke answer. But surely I will like to express my gratitude to the @heemayl quick, wise and very informative answer +1. Thanks to everyone
      – lese
      Sep 21 '16 at 10:02













      38














      You can't kill a Zombie (process), it is already dead. It is just waiting for its parent process to do wait(2) and collect its exit status. It won't take any resource on the system other than a process table entry.



      You can send SIGCHLD to its parent to let it know that one of its children has terminated (i.e. request it to collect child's exit status). This signal can be ignored (which is the default):



      kill -CHLD <PPID>


      (Replace <PPID> with the actual PID of the parent.)



      Or you can kill the parent process so that init (PID 1) will inherit the zombie process and reap it properly (it's one of init's main tasks to inherit any orphan and do wait(2) regularly). But killing the parent is not recommended. Generally, creation of zombie processes indicates programming issue/issues, and you should try to fix or report that instead.






      share|improve this answer



















      • 8




        You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
        – Andrew Henle
        Sep 19 '16 at 10:43






      • 1




        @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
        – R..
        Sep 19 '16 at 16:36










      • @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
        – Andrew Henle
        Sep 19 '16 at 20:50






      • 1




        @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
        – Alexis Wilke
        Sep 20 '16 at 0:58










      • It can't hurt, but I wouldn't put odds on it working.
        – Barmar
        Sep 22 '16 at 1:26
















      38














      You can't kill a Zombie (process), it is already dead. It is just waiting for its parent process to do wait(2) and collect its exit status. It won't take any resource on the system other than a process table entry.



      You can send SIGCHLD to its parent to let it know that one of its children has terminated (i.e. request it to collect child's exit status). This signal can be ignored (which is the default):



      kill -CHLD <PPID>


      (Replace <PPID> with the actual PID of the parent.)



      Or you can kill the parent process so that init (PID 1) will inherit the zombie process and reap it properly (it's one of init's main tasks to inherit any orphan and do wait(2) regularly). But killing the parent is not recommended. Generally, creation of zombie processes indicates programming issue/issues, and you should try to fix or report that instead.






      share|improve this answer



















      • 8




        You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
        – Andrew Henle
        Sep 19 '16 at 10:43






      • 1




        @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
        – R..
        Sep 19 '16 at 16:36










      • @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
        – Andrew Henle
        Sep 19 '16 at 20:50






      • 1




        @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
        – Alexis Wilke
        Sep 20 '16 at 0:58










      • It can't hurt, but I wouldn't put odds on it working.
        – Barmar
        Sep 22 '16 at 1:26














      38












      38








      38






      You can't kill a Zombie (process), it is already dead. It is just waiting for its parent process to do wait(2) and collect its exit status. It won't take any resource on the system other than a process table entry.



      You can send SIGCHLD to its parent to let it know that one of its children has terminated (i.e. request it to collect child's exit status). This signal can be ignored (which is the default):



      kill -CHLD <PPID>


      (Replace <PPID> with the actual PID of the parent.)



      Or you can kill the parent process so that init (PID 1) will inherit the zombie process and reap it properly (it's one of init's main tasks to inherit any orphan and do wait(2) regularly). But killing the parent is not recommended. Generally, creation of zombie processes indicates programming issue/issues, and you should try to fix or report that instead.






      share|improve this answer














      You can't kill a Zombie (process), it is already dead. It is just waiting for its parent process to do wait(2) and collect its exit status. It won't take any resource on the system other than a process table entry.



      You can send SIGCHLD to its parent to let it know that one of its children has terminated (i.e. request it to collect child's exit status). This signal can be ignored (which is the default):



      kill -CHLD <PPID>


      (Replace <PPID> with the actual PID of the parent.)



      Or you can kill the parent process so that init (PID 1) will inherit the zombie process and reap it properly (it's one of init's main tasks to inherit any orphan and do wait(2) regularly). But killing the parent is not recommended. Generally, creation of zombie processes indicates programming issue/issues, and you should try to fix or report that instead.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Sep 20 '16 at 3:27

























      answered Sep 19 '16 at 7:44









      heemayl

      34.6k373103




      34.6k373103








      • 8




        You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
        – Andrew Henle
        Sep 19 '16 at 10:43






      • 1




        @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
        – R..
        Sep 19 '16 at 16:36










      • @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
        – Andrew Henle
        Sep 19 '16 at 20:50






      • 1




        @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
        – Alexis Wilke
        Sep 20 '16 at 0:58










      • It can't hurt, but I wouldn't put odds on it working.
        – Barmar
        Sep 22 '16 at 1:26














      • 8




        You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
        – Andrew Henle
        Sep 19 '16 at 10:43






      • 1




        @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
        – R..
        Sep 19 '16 at 16:36










      • @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
        – Andrew Henle
        Sep 19 '16 at 20:50






      • 1




        @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
        – Alexis Wilke
        Sep 20 '16 at 0:58










      • It can't hurt, but I wouldn't put odds on it working.
        – Barmar
        Sep 22 '16 at 1:26








      8




      8




      You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
      – Andrew Henle
      Sep 19 '16 at 10:43




      You can send SIGCHLD to it's parent to let it know that one if it's children has terminated (i.e. request it to collect child's exit status), this signal can be ignored (default) The problem with that is that if a process ignores SIGCHLD, no zombie would be created. So if it's not ignoring SIGCHLD, and zombies aren't getting reaped, the process is either buggy or doesn't care about zombie children. Given the process in question is git clone ..., I'm betting it simply doesn't care about zombie children since it's a (hopefully) short-lived process that does its job and then exits.
      – Andrew Henle
      Sep 19 '16 at 10:43




      1




      1




      @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
      – R..
      Sep 19 '16 at 16:36




      @AndrewHenle: While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped.
      – R..
      Sep 19 '16 at 16:36












      @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
      – Andrew Henle
      Sep 19 '16 at 20:50




      @R While that's mostly true, the default action (SIG_DFL) for SIGCHILD is also to ignore it, but in this case zombies most certainly are not automatically reaped. I'm not sure what you're referring to. Are you referring to the processes not getting reaped in the question? I'm not seeing how sending SIGCHLD to a process that has its SIGCHLD handler set to SIG_IGN (either explicitly or by default) is going to cause that process to reap any zombies.
      – Andrew Henle
      Sep 19 '16 at 20:50




      1




      1




      @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
      – Alexis Wilke
      Sep 20 '16 at 0:58




      @AndrewHenle, sending a SIGCHLD may work this time. The last time it may have missed the signal or two children died at the same time and the code is not smart enough to handle both deaths simultaneously.
      – Alexis Wilke
      Sep 20 '16 at 0:58












      It can't hurt, but I wouldn't put odds on it working.
      – Barmar
      Sep 22 '16 at 1:26




      It can't hurt, but I wouldn't put odds on it working.
      – Barmar
      Sep 22 '16 at 1:26











      1














      to look for zombie processes:



      ps aux | grep -w Z | grep -v grep

      ps -eo stat,ppid | grep -w Z


      to kill zombie process, the parent IDs need to be killed ie PPID:



      kill PPID1 PPID2

      kill $(ps -eo stat,ppid|grep -w Z|awk '{print $2}'|tr "n" " ")





      share|improve this answer




























        1














        to look for zombie processes:



        ps aux | grep -w Z | grep -v grep

        ps -eo stat,ppid | grep -w Z


        to kill zombie process, the parent IDs need to be killed ie PPID:



        kill PPID1 PPID2

        kill $(ps -eo stat,ppid|grep -w Z|awk '{print $2}'|tr "n" " ")





        share|improve this answer


























          1












          1








          1






          to look for zombie processes:



          ps aux | grep -w Z | grep -v grep

          ps -eo stat,ppid | grep -w Z


          to kill zombie process, the parent IDs need to be killed ie PPID:



          kill PPID1 PPID2

          kill $(ps -eo stat,ppid|grep -w Z|awk '{print $2}'|tr "n" " ")





          share|improve this answer














          to look for zombie processes:



          ps aux | grep -w Z | grep -v grep

          ps -eo stat,ppid | grep -w Z


          to kill zombie process, the parent IDs need to be killed ie PPID:



          kill PPID1 PPID2

          kill $(ps -eo stat,ppid|grep -w Z|awk '{print $2}'|tr "n" " ")






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 27 '17 at 19:55









          Stephen Rauch

          3,328101428




          3,328101428










          answered Feb 27 '17 at 19:19









          user218243

          111




          111























              0














              When a parent process dies, all zombie process will get cleaned up.
              Don’t kill parent process just to clean up zombie process. It will come again when you re-run your program.
              Fix your program with properly calling “wait ()” or “waitpid ()” system call.






              share|improve this answer


























                0














                When a parent process dies, all zombie process will get cleaned up.
                Don’t kill parent process just to clean up zombie process. It will come again when you re-run your program.
                Fix your program with properly calling “wait ()” or “waitpid ()” system call.






                share|improve this answer
























                  0












                  0








                  0






                  When a parent process dies, all zombie process will get cleaned up.
                  Don’t kill parent process just to clean up zombie process. It will come again when you re-run your program.
                  Fix your program with properly calling “wait ()” or “waitpid ()” system call.






                  share|improve this answer












                  When a parent process dies, all zombie process will get cleaned up.
                  Don’t kill parent process just to clean up zombie process. It will come again when you re-run your program.
                  Fix your program with properly calling “wait ()” or “waitpid ()” system call.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 28 '18 at 5:42









                  Sumanth S

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f310768%2falternative-way-to-kill-a-zombie-process%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Morgemoulin

                      Scott Moir

                      Souastre