Bug 1812 - ControlPersist causes defunct/zombie processes
Summary: ControlPersist causes defunct/zombie processes
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 5.6p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL: http://bugs.debian.org/594687
Keywords:
Depends on:
Blocks: V_5_7
  Show dependency treegraph
 
Reported: 2010-08-31 23:39 AEST by Colin Watson
Modified: 2011-01-24 12:33 AEDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Watson 2010-08-31 23:39:41 AEST
In the linked Debian bug, martin f krafft reported:

"Since switching on ControlPersist, I have dozens of defunct ssh
processes in the process table, e.g.:

  madduck  28025  0.0  0.0  40612  2784 pts/8    S+   09:17   0:00 ssh pulse
  madduck  28028  0.0  0.0      0     0 pts/8    Z+   09:17   0:00 [ssh] <defunct>
  madduck  28029  0.0  0.0  40704  1188 ?        Ss   09:17   0:00 ssh pulse

The PIDs suggest thatt hese are related. It looks to me that the
second process is the clone process, which, according to strace,
only does:

  open("/dev/null", O_RDWR)               = 5
  dup2(5, 0)                              = 0
  dup2(5, 1)                              = 1
  close(5)                                = 0
  clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f901060c9f0) = 20475
  exit_group(0)                           = ?

It looks like the parent is not reaping this clone after it
terminates."

I can reproduce this.  Using -vvv shows that the process in question forked by control_persist_detach, and exits in the daemon call in fork_postauth.  The ssh client doesn't appear to install a SIGCHLD handler anywhere.
Comment 1 Damien Miller 2010-10-12 13:31:52 AEDT
ssh now installs a SIGCHILD handler to reap these.
Comment 2 Damien Miller 2011-01-24 12:33:47 AEDT
Move resolved bugs to CLOSED after 5.7 release