Subject: Re: bug#61350: Eglot over Tramp freezes with large project

From: João Távora <[email-masked]>
Date: Sun, 26 Feb 2023 21:45:46 +0000

João Távora <[email-masked]> writes:

> So maybe one should disable it by default.  How does one disable it? I
> have trouble understanding from tramp-use-ssh-controlmaster-options and
> tramp-ssh-controlmaster-options.

In the meantime I have finally, with great Docker-relearning hardship,
setup a reproduction environment.  You'll see it follows exactly
Thomas's reproduction recipe almost until the end.  It sets up a server
on port 2022 

I attach the dockerfile.

$ docker build -t sshubuntu .
$ docker run -d -p 2022:22 sshubuntu
$ /path/to/emacs -Q /ssh:sshuser@localhost#2022:/home/sshuser/yacy_search_server/source/net/yacy/yacy.java -f eglot

Now the odd bit.  Sometimes this works, sometimes it doesn't!!!
Sometimes it finds '~/bin/jtdls' in the remote's PATH and sometimes it
doesn't!  I have no idea why.  Maybe someone can help me debug: how is
PATH to work?  In the server I can see that on simple ssh login,
~/bin/jdtls _is_ found.

Anyway, when I _do_ manage to get it to find sshuser's '~/bin/jtdls':

* I do experience the hang regularly, but not always at the same point
  in time.

* I don't know how to obtain the pretty Backtrace that you Michael got.
  Michael how do you get that??  Maybe you're using some tramp flag,
  because debug-on-error and debug-on-quit don't work.

* If I set 

    (setq tramp-ssh-controlmaster-options nil
        tramp-use-ssh-controlmaster-options nil)

  I _no longer_ experience the hang.  This is after visiting 5 or 6
  files, trying some completion, M-. xref-find-definitions, etc.

Michael can you confirm that these are per-buffer values?  Would it
make sense for Eglot to set them like so in its minor mode hook?

João

FROM ubuntu:latest
RUN apt update && apt install  openssh-server sudo openjdk-17-jdk openjdk-17-jre git wget -y
# Create a user “sshuser” and group “sshgroup”
RUN groupadd sshgroup && useradd -ms /bin/bash -g sshgroup sshuser
# Create sshuser directory in home
RUN mkdir -p /home/sshuser/.ssh
# Copy the ssh public key in the authorized_keys file. The idkey.pub below is a public key file you get from ssh-keygen. They are under ~/.ssh directory by default.
COPY id_rsa.pub /home/sshuser/.ssh/authorized_keys
# change ownership of the key file. 
RUN chown sshuser:sshgroup /home/sshuser/.ssh/authorized_keys && chmod 600 /home/sshuser/.ssh/authorized_keys
# Start SSH service
RUN service ssh start
# Expose docker port 22
EXPOSE 22

USER sshuser
WORKDIR /home/sshuser
RUN git clone --depth 1 --no-tags --single-branch -b eglot-tramp-freeze-repro https://github.com/thkoch2001/yacy_search_server
RUN wget https://download.eclipse.org/jdtls/milestones/1.19.0/jdt-language-server-1.19.0-202301171536.tar.gz
RUN mkdir jdtls
RUN tar xvfz jdt-language-server-1.19.0-202301171536.tar.gz -C jdtls
RUN mkdir bin
RUN ln -sf ~/jdtls/bin/jdtls ~/bin/jdtls

USER root
CMD ["/usr/sbin/sshd","-D"]