~sircmpwn/aerc2#327: 
Zombie child processes

It seems that aerc tends to accumulate zombie child processes, which seemingly happens when viewing or composing emails and then closing their corresponding tabs.

I've seen upwards of >10 zombie children at least once (a mix of vim, less and awk child processes, IIRC), but I wouldn't be surprised if it were possible to have many more.

This is not necessarily a serious problem in itself, but I regularly run a series of tests on my machines, one of which is a check for persistent zombie processes, which is a good heuristic that tends to reveal more serious problems (hung parent processes, usually), so it would be nice if this problem was resolved, since aerc is currently the only program running on my machines that accumulates zombie children when not hung.

I'm not exactly a Go expert, but according to the following thread, this seems to be easily fixed by adding defer cmd.Wait() statements after starting child processes (with cmd := exec.Command(...), for instance), although I'm sure in some cases it could be slightly more complicated:

https://stackoverflow.com/questions/36050503/golang-child-processes-become-zombies

Here's a sample output of my debug log:

pid 1675 is a zombie!
systemd,1
  `-tmux: server,4025 -2 new-session -A -s tu1
      `-fish,4029
          `-fish,11576 /home/wizeman/bin/aerc.sh
              `-.aerc-wrapped,11595
                  `-(nvim,1675)

pid 8968 is a zombie!
systemd,1
  `-tmux: server,4025 -2 new-session -A -s tu1
      `-fish,4029
          `-fish,11576 /home/wizeman/bin/aerc.sh
              `-.aerc-wrapped,11595
                  `-(less,8968)

pid 11683 is a zombie!
systemd,1
  `-tmux: server,4025 -2 new-session -A -s tu1
      `-fish,4029
          `-fish,11576 /home/wizeman/bin/aerc.sh
              `-.aerc-wrapped,11595
                  `-(less,11683)

pid 11773 is a zombie!
systemd,1
  `-tmux: server,4025 -2 new-session -A -s tu1
      `-fish,4029
          `-fish,11576 /home/wizeman/bin/aerc.sh
              `-.aerc-wrapped,11595
                  `-(less,11773)

pid 11775 is a zombie!
systemd,1
  `-tmux: server,4025 -2 new-session -A -s tu1
      `-fish,4029
          `-fish,11576 /home/wizeman/bin/aerc.sh
              `-.aerc-wrapped,11595
                  `-(less,11775)

pid 31662 is a zombie!
systemd,1
  `-tmux: server,4025 -2 new-session -A -s tu1
      `-fish,4029
          `-fish,11576 /home/wizeman/bin/aerc.sh
              `-.aerc-wrapped,11595
                  `-(nvim,31662)
Status
RESOLVED FIXED
Submitter
~wizeman
Assigned to
No-one
Submitted
1 year, 7 months ago
Updated
1 year, 7 months ago
Labels
No labels applied.

~keur 1 year, 7 months ago

Hi. Does this happen on current HEAD?

~wizeman REPORTED FIXED 1 year, 7 months ago

Seems to be fixed, as far as I can tell. Thanks!

~keur 1 year, 7 months ago

No problem! :)

Register here or Log in to comment, or comment via email.