spacemacs icon indicating copy to clipboard operation
spacemacs copied to clipboard

Tramp re-opens ssh connection over and over

Open ltrottier opened this issue 6 years ago • 22 comments

Description :octocat:

I open a python file over ssh using tramp, start editing, then stop editing (I stay in the buffer). Note that I have pyenv activated to a local virtualenv. Then, as soon as I execute an action, Tramp re-opens the ssh connection. This creates a freeze of about 1-2 seconds before the action gets executed. This happens over and over.

I tried all tramp-cleanup-*, without success.

Reproduction guide :beetle:

  • Start Emacs
  • [SPC f f] /ssh:aws1:/home/ubuntu/file.py
  • Start editing.

where aws1 is a host in .ssh/config

Observed behaviour: :eyes: :broken_heart:

  • As soon as I stop editing, the next action freezes for 1-2 seconds because tramp re-opens the connection.

Expected behaviour: :heart: :smile:

  • The next action should not freeze for 1-2 seconds after I stop editing.

System Info :computer:

  • OS: gnu/linux
  • Emacs: 26.1
  • Spacemacs: 0.200.13
  • Spacemacs branch: master (rev. c7a103a77)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(yaml bibtex helm emacs-lisp git html
      (latex :variables latex-build-command "LaTeX" TeX-master nil)
      markdown pdf-tools python
      (org :variables org-enable-github-support t org-enable-reveal-js-support t org-html-validation-link nil)
      search-engine
      (spell-checking :variables spell-checking-enable-by-default nil)
      (syntax-checking :variables syntax-checking-enable-by-default nil)
      themes-megapack)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Backtrace :paw_prints:

I open the file:

Tramp: Opening connection for aws1 using ssh...
Tramp: Sending command ‘exec ssh -q   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none aws1’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘aws1’
Tramp: Opening connection for aws1 using ssh...done

I start editing and stop at this point. Then I start editing again (I press [i] or [j] for instance), then this shows up:

Tramp: Opening connection for aws1 using ssh...
Tramp: Sending command ‘exec ssh -q   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none aws1’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘aws1’
Tramp: Opening connection for aws1 using ssh...done

which creates a freeze of about 1-2 seconds. I stop editing than start again:

Tramp: Opening connection for aws1 using ssh...
Tramp: Sending command ‘exec ssh -q   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none aws1’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘aws1’
Tramp: Opening connection for aws1 using ssh...done

and it happens again, over and over.

ltrottier avatar Oct 26 '18 17:10 ltrottier

I have the same problem, the following workaround fixed it for me:

  (remove-hook 'python-mode-hook 'spacemacs//init-eldoc-python-mode)

simonpintarelli avatar Nov 03 '18 09:11 simonpintarelli

Can confirm this behavior. Reconnect attempts also happen when trying to use any anaconda-mode functionality (e.g. SPC-m-g-g to jump to definition).

betaprior avatar Nov 12 '18 09:11 betaprior

Removing eldoc definitely helps, but removing eldoc is not a long term solution.

ltrottier avatar Dec 06 '18 20:12 ltrottier

I read here that:

It is important to remember that remote_host must be a real host name or an IP address. SSH aliases not allowed to be used with anaconda-mode.

Is this related ?

ltrottier avatar Dec 06 '18 20:12 ltrottier

This is also an issue for me! Can confirm that removing eldoc helps! @simonpintarelli How did you come to this conclusion?

slealq avatar Mar 21 '19 19:03 slealq

I, too, have this problem. I have switched to nvim for my remote editing needs.

NightMachinery avatar Sep 05 '19 15:09 NightMachinery

Is this still a problem for anyone else?

padraic00 avatar Oct 01 '19 13:10 padraic00

I pulled master, and it is still an issue for me.

System Info :computer:

  • OS: gnu/linux
  • Emacs: 26.3
  • Spacemacs: 0.200.13
  • Spacemacs branch: master (rev. 26b8fe0)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(csv
 (auto-completion :variables auto-completion-return-key-behavior 'complete auto-completion-tab-key-behavior 'cycle auto-completion-complete-with-key-sequence nil auto-completion-complete-with-key-sequence-delay 0.1 auto-completion-private-snippets-directory nil auto-completion-enable-snippets-in-popup t auto-completion-enable-help-tooltip 'manual)
 bibtex
 (c-c++ :variables c-c++-default-mode-for-headers 'c++-mode c-c++-enable-clang-support 't)
 emacs-lisp git gtags helm html
 (javascript :variables js-indent-level 2)
 (latex :variables latex-build-command "LaTeX" TeX-master nil)
 markdown
 (org :variables org-enable-github-support t org-enable-reveal-js-support t org-html-validation-link nil)
 pdf-tools python search-engine
 (shell :variables shell-default-height 30 shell-default-position 'bottom)
 yaml)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2

ltrottier avatar Oct 02 '19 18:10 ltrottier

I am having this issue too. Very frustrating.

nbren12 avatar Oct 08 '19 16:10 nbren12

I am also having this issue. Is there anything I can do to help pinpoint the source of the problem?

cwitte avatar Nov 21 '19 23:11 cwitte

I'm not suffering from this problem anymore since I've switched to the develop branch.

simonpintarelli avatar Nov 22 '19 08:11 simonpintarelli

I'm not suffering from this problem anymore since I've switched to the develop branch.

This is without your previous workaround in place? Could you provide a config summary @simonpintarelli?

padraic00 avatar Nov 27 '19 04:11 padraic00

@padraic00 This is without the workaround using the default config.

simonpintarelli avatar Nov 27 '19 09:11 simonpintarelli

I tried it with the branch develop and it is still an issue for me.

@simonpintarelli What did you do exactly to make it work ?

System Info :computer:

  • OS: gnu/linux
  • Emacs: 26.3
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 6f029cc)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
((auto-completion :variables auto-completion-return-key-behavior 'complete auto-completion-tab-key-behavior 'cycle auto-completion-complete-with-key-sequence nil auto-completion-complete-with-key-sequence-delay 0.1 auto-completion-private-snippets-directory nil auto-completion-enable-snippets-in-popup t auto-completion-enable-help-tooltip 'manual)
 (c-c++ :variables c-c++-default-mode-for-headers 'c++-mode c-c++-enable-clang-support 't)
 csv emacs-lisp git gtags helm html java
 (javascript :variables js-indent-level 4 js2-basic-offset 4)
 (latex :variables latex-build-command "LaTeX" TeX-master nil)
 lsp markdown multiple-cursors
 (org :variables org-enable-github-support t org-enable-reveal-js-support t org-html-validation-link nil)
 (python :variables python-backend 'anaconda)
 search-engine
 (shell :variables shell-default-height 30 shell-default-position 'bottom)
 (syntax-checking :variables syntax-checking-enable-tooltips nil syntax-checking-enable-by-default nil)
 treemacs yaml)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2

ltrottier avatar Dec 17 '19 20:12 ltrottier

I also had the same problem editing a python file. I checked out the develop branch without changing my config and the problem went away. I didn't try out the workaround from above. My config is the default config with changed layers (and only minor changes otherwise).

System Info :computer:

  • OS: gnu/linux
  • Emacs: 26.3
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 53c105958)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(auto-completion helm org emoji games selectric xkcd emacs-lisp haskell html java javascript latex lua markdown plantuml python shell-scripts sql yaml git version-control themes-megapack lsp)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2

Garmelon avatar Dec 23 '19 16:12 Garmelon

Any news on this? I'm still experiencing this on dev branch.

aronla avatar Jun 18 '20 12:06 aronla

I also find this pretty frustrating bc I do a lot of python remote editing. For some reason simonpintarelli's eldoc removal for just python wasn't working for me (and I didn't have time to debug it), but I don't really use eldoc anyway. So in case anyone else just wants a nuclear option (and also to serve as a ping in case someone else has a solution), you can set (global-eldoc-mode -1) and just remove eldoc entirely. So far, it's working well

JZL avatar Oct 26 '20 17:10 JZL

It's driven me to host emacs on the remote machine. Would love to see a more robust solution.

padraic00 avatar Oct 26 '20 18:10 padraic00

I opened an upstream FR. This happens with Doom, too, and has nothing to do with Spacemacs, I guess.

NightMachinery avatar Mar 27 '21 09:03 NightMachinery

Still experiencing this issue.

dgealow avatar Apr 07 '22 18:04 dgealow

I've hidden a few comments. Please refrain yourselves from saying "I'm having the same issue" or "Is this still an issue" without providing any extra information.

lebensterben avatar Apr 07 '22 18:04 lebensterben

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar May 01 '24 16:05 github-actions[bot]