Subject: Re: bug#43226: 28.0.50; Running Tramp tests on MS-Windows leaves zombie processes on the remote

From: Michael Albinus <[email-masked]>
Date: Sun, 06 Sep 2020 10:49:51 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> Maybe it has nothing to do with the local OS but with the local
>> program? On GNU/Linux we use ssh, on MS Windows we use plink.
>
> Maybe so, but what do we expect from ssh/plink which should happen
> when the connection closes, that might not happen with plink?
>
> E.g., if I run 'plink ... "cat foo"', the processes created on the
> remote disappear immediately as soon as 'cat' finishes its job.  Same
> if I log in and type Ctrl-D, or just close the window where plink runs
> interactively.  What is different about the connections made by Tramp
> or the test suite?

The difference is, that in your example the remote process finishes. In
Tramp, the local ssh or plink process is killed.

Does the appended patch makes a difference?

Best regards, Michael.

*** /tmp/ediffJtV3Wc	2020-09-06 10:45:52.531153450 +0200
--- /home/albinus/src/tramp/lisp/tramp-cmds.el	2020-09-06 10:44:50.956836536 +0200
***************
*** 122,127 ****
--- 122,128 ----
  		 (or (not keep-processes)
  		     (eq key (tramp-get-process vec))))
  	(tramp-flush-connection-properties key)
+ 	(process-send-eof key)
  	(delete-process key)))

      ;; Remove buffers.
***************
*** 186,192 ****

    ;; Remove processes and buffers.
    (dolist (name (tramp-list-tramp-buffers))
!     (when (processp (get-buffer-process name)) (delete-process name))
      (when (bufferp (get-buffer name)) (kill-buffer name)))

    ;; The end.
--- 187,195 ----

    ;; Remove processes and buffers.
    (dolist (name (tramp-list-tramp-buffers))
!     (when (processp (get-buffer-process name))
!       (process-send-eof name)
!       (delete-process name))
      (when (bufferp (get-buffer name)) (kill-buffer name)))

    ;; The end.