GNU bug report logs - #43226
28.0.50; Running Tramp tests on MS-Windows leaves zombie processes on the remote

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sat, 5 Sep 2020 16:39:02 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: HA <pablo <at> seestieto.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 43226 <at> debbugs.gnu.org
Subject: bug#43226: 28.0.50; Running Tramp tests on MS-Windows leaves zombie processes on the remote
Date: Sat, 29 Oct 2022 16:48:51 +0200
HA <pablo <at> seestieto.com> writes:

Hi,

> You're right – when trying the test case with just ssh in Emacs 28 on
> Windows, process-send-eof successfully terminates the remote cat
> process, it just never receives the actual Ctrl-D. (Verified this by
> stracing the remote cat process.)

Likely, it terminates the local ssh process, which kills the remote cat
process as side effect.

> The test case where I call start-file-process with default-directory
> pointing to a remote directory ("/sshx:...") and run simply "cat"
> behaves differently in that it runs cmdproxy.exe instead of ssh.exe
> directly, uses the -t option twice to force creation of PTYs on the
> remote end, and uses -o RemoteCommand="/bin/sh -i" for interactive
> shell. It does not seem to receive any input from Emacs, and stays
> running.

Yes.

> Same things also happens if I run the test with "ssh -t -t" so
> apparently somehow pseudo terminals on the remote end causes issues
> here.

Perhaps.

> The normal "ssh" method (without -x) does not seem to be able to connect
> at all on my Windows system for whatever reason, so I can't comment if
> works any better.

Right. And I have no explanation for this.

> Interestingly, similar test on Emacs 27.1 on GNU/Linux
> receives the input but the cat process also stays running there, so
> not sure if process-send-eof does the right thing even here.
>
> (let* ((default-directory "/sshx:happy:/tmp")
>       (sshz (start-file-process "eoftest" (get-buffer-create "*eoftest*") "cat")))
>   (list-processes)
>   (sit-for 10) ; Run strace -p $(pgrep cat) on remote
>   (process-send-string sshz "foo")
>   (process-send-eof sshz))
>
> strace: Process 18005 attached
> read(0, "foo", 131072)                  = 3
> write(1, "foo", 3)                      = 3
> read(0, 

I can reproduce it here with Emacs 29. However, if you replace
process-send-eof by kill-process it works. But I don't know whether this
is an acceptable solution.

Another idea is to use EscapeChar. Tramp calls " ssh -q -e none -t -t ...".
If we use an EscapeChar, like the default "~", we could send "\n~."
(newline escape period) in order to disconnect, imitating eof. But I
haven't tested it. And there might be collateral damages when sending
binary data.

Best regards, Michael.




This bug report was last modified 2 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.