[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ghost 'ssh' and 'cvs server' processes



Please CC me, as I don't subscribe to the list.

I run cvs with CVS_RSH=ssh.

I regulary find hundreds of ghost processes both on the clients and on
the cvs server.

These are the programs/versions usually involved:

,----
| Package: cvs	Version: 1.11.1p1debian-8.1
| Package: less	Version: 374-4
| Package: ssh	Version: 1:3.4p1-1
`----

I suspect ssh is the cause, but I'm not absolutely sure :(
I've seen other ssh versions behaving similarly.

I seek some advice.
Is it only me? Is there a workaround?
Should I file a bug against ssh?

If I run:

  # cvs stat -v | less +G

I get the expected behaviour.


But if I run:

  # cvs stat -v | less

I expect a long list. The process forest looks like this:

  johndoe  25078  pts/0  S  |   \_ bash
  johndoe  25143  pts/0  S  |       \_ cvs stat -v
  johndoe  25145  pts/0  S  |       |   \_ ssh cvs-server-box cvs server
  johndoe  25144  pts/0  S  |       \_ less

I'm satisfied with what I see on the first page 'less' shows and just
quit. I see this message in the xterm window:

  cvs [status aborted]: received broken pipe signal

Looking att the process forest again, I see the ssh process is alive
(25145 above) instead of being dead and lost contact with its parent:

  johndoe  25145  pts/0  S  ssh cvs-server-box cvs server

'strace' shows:

  # strace -p 25145
  select(9, [4], [], NULL, NULL)          = 1 (in [4])
  read(4, "\367"..., 8192) = 56
  select(9, [4], [], NULL, NULL

This is 1 ghost process on the client box, waiting.
Here comes 4 more ghost processes, on the cvs server box this time.

If I take a look at the process forest on the cvs server, I see:

  root     24474  ?      S  \_ /usr/sbin/sshd
  johndoe  24476  ?      S  |   \_ /usr/sbin/sshd
  johndoe  24477  ?      S  |       \_ cvs server
  johndoe  24482  ?      S  |           \_ cvs server

Server process 24474 is also waiting to get something (which never
comes) from the client. 'strace' shows:

  # strace -p 24476
  select(13, [5 6 8], [], NULL, {43, 670000}) = 0 (Timeout)
  rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
  select(13, [5 6 8], [5], NULL, {60, 0}) = 1 (out [5], left {60, 0})
  rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
  write(5, "<\223"..., 56) = 56
  select(13, [5 6 8], [], NULL, {60, 0})  = 1 (in [5], left {59, 990000})
  rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
  read(5, "\206"..., 16384) = 32

If I now kill the runaway ssh process on the client box:

  # kill 25145

  # strace -p 25145
  ...
  --- SIGTERM (Terminated) @ 0 (0) ---
  sigreturn()                             = ? (mask now [])
  close(8)                                = 0
  munmap(0x40249000, 139264)              = 0
  ioctl(0, SNDCTL_TMR_TIMEBASE, 0xbffff308) = -1 EINVAL (Invalid argument)
  fcntl64(0, F_GETFL)                     = 0x800 (flags O_RDONLY|O_NONBLOCK)
  fcntl64(0, F_SETFL, O_RDONLY)           = 0
  ioctl(1, SNDCTL_TMR_TIMEBASE, 0xbffff308) = -1 EINVAL (Invalid argument)
  fcntl64(1, F_GETFL)                     = 0x801 (flags O_WRONLY|O_NONBLOCK)
  fcntl64(1, F_SETFL, O_WRONLY)           = 0
  ioctl(2, SNDCTL_TMR_TIMEBASE, {B38400 opost isig -icanon -echo ...}) = 0
  write(2, "Killed by signal 15.\r\n", 22) = 22
  shutdown(4, 2 /* send and receive */)   = 0
  close(4)                                = 0
  brk(0x809b000)                          = 0x809b000
  _exit(255)                              = ?

the 4 processes on the cvs server will die too:

  # strace -p 24476
  ...
  shutdown(10, 2 /* send and receive */)  = 0
  close(10)                               = 0
  close(10)                               = -1 EBADF (Bad file descriptor)
  close(10)                               = -1 EBADF (Bad file descriptor)
  close(12)                               = 0
  shutdown(8, 2 /* send and receive */)   = 0
  close(8)                                = 0
  close(8)                                = -1 EBADF (Bad file descriptor)
  close(8)                                = -1 EBADF (Bad file descriptor)
  geteuid32()                             = 339
  getegid32()                             = 500
  unlink("/tmp/ssh-XXuo1PLU/agent.31039") = 0
  rmdir("/tmp/ssh-XXuo1PLU")              = 0
  getuid32()                              = 339
  time([1046702900])                      = 1046702900
  getpid()                                = 31039
  rt_sigaction(SIGPIPE, {0x401dcf48, [], 0x4000000}, {SIG_IGN}, 8) = 0
  socket(PF_UNIX, SOCK_DGRAM, 0)          = 8
  fcntl64(8, F_SETFD, FD_CLOEXEC)         = 0
  connect(8, {sin_family=AF_UNIX, path="/dev/log"}, 16) = 0
  send(8, "<38>Mar  3 15:48:20 PAM_unix[310"..., 70, 0) = 70
  rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
  close(8)                                = 0
  time([1046702900])                      = 1046702900
  getpid()                                = 31039
  rt_sigaction(SIGPIPE, {0x401dcf48, [], 0x4000000}, {SIG_IGN}, 8) = 0
  socket(PF_UNIX, SOCK_DGRAM, 0)          = 8
  fcntl64(8, F_SETFD, FD_CLOEXEC)         = 0
  connect(8, {sin_family=AF_UNIX, path="/dev/log"}, 16) = 0
  send(8, "<35>Mar  3 15:48:20 sshd[31039]:"..., 80, 0) = 80
  rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
  getuid32()                              = 339
  open("/etc/security/pam_env.conf", O_RDONLY) = 9
  fstat64(9, {st_mode=S_IFREG|0644, st_size=3101, ...}) = 0
  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000
  read(9, "# $Date: 1998/07/12 05:17:16 $\n#"..., 4096) = 3101
  read(9, "", 4096)                       = 0
  close(9)                                = 0
  munmap(0x40014000, 4096)                = 0
  open("/etc/environment", O_RDONLY)      = -1 ENOENT (No such file or directory)
  munmap(0x403b6000, 7256)                = 0
  munmap(0x403b8000, 94176)               = 0
  munmap(0x403cf000, 13156)               = 0
  munmap(0x403d3000, 10912)               = 0
  munmap(0x403d6000, 10588)               = 0
  munmap(0x403d9000, 7372)                = 0
  munmap(0x403db000, 11744)               = 0
  munmap(0x403de000, 30752)               = 0
  munmap(0x403e8000, 15264)               = 0
  shutdown(5, 2 /* send and receive */)   = 0
  close(5)                                = 0
  brk(0x80a6000)                          = 0x80a6000
  write(4, "\0\0\0\1&", 5)                = 5
  _exit(0)                                = ?


Cheers,
Cristian



Reply to: