Emacs 26.1 hangs when tramp is trying to save a file over ssh

928 Views Asked by At

I’m using Emacs version 26.1 installed via homebrew on macOS.

It often hangs while I’m editing a file over ssh using tramp (say, every 20 minutes). When I hit Ctrl-x-s to save file (or automatic backup is triggered), tramp starts saving file. However, it hangs with a message

Waiting for prompts from remote shell… \

If I hit Ctrl-g, it seems to have no effect. I hit a second Ctrl-g, emacs goes background with a message

zsh: suspended emacs

I tried fg command to bring emacs back to front:

$ fg
[1]  + continued  emacs
Emacs is resuming after an emergency escape.
Auto-save? (y or n) y
Auto-save done
Abort (and dump core)? (y or n) n
Continuing...

And emacs continues to hang with a blank screen. Thus, the only way I can take is to answer ‘y’ to the second question and abort the Emacs process.

I tried to check the debug buffer of tramp, but I couldn’t read it because there are too many printed lines and the debug buffer does not scroll, and the emacs does not accept any keystroke except Ctrl-g.

I have the following lines in my emacs.el

(require 'tramp)
(setq tramp-default-method "ssh")
(setq tramp-verbose 5)
(add-to-list 'backup-directory-alist
   (cons tramp-file-name-regexp nil))

Emacs was working quite well before upgrading. (I don't remember the previous version...)

Do you have any advice or hints? Thanks in advance.

Edit:

Here's backtrace showed when the emacs process is terminated (by answering 'y' to the second question above)

[1]  + continued  emacs
Emacs is resuming after an emergency escape.
Auto-save? (y or n) y
Auto-save done
Abort (and dump core)? (y or n) y
Fatal error 6: Abort trapMemory^H^H^H^N^P
Backtrace:
0   emacs                               0x0000000100096b2d emacs_backtrace + 157
1   emacs                               0x000000010007e9cd terminate_due_to_signal + 110
2   emacs                               0x00000001000955ba init_baud_rate + 0
3   emacs                               0x0000000100087a98 kbd_buffer_nr_stored + 0
4   emacs                               0x00000001000965fb deliver_process_signal + 61
5   libsystem_platform.dylib            0x00007fffa595eb3a _sigtramp + 26
6   ???                                 0xb0e07c5c8dafe0b2 0x0 + 12745323682414452914
7   emacs                               0x000000010013d491 really_call_select + 88
8   emacs                               0x000000010013d42f thread_select + 58
9   emacs                               0x0000000100124702 wait_reading_process_output + 3244
10  emacs                               0x00000001001239f3 Faccept_process_output + 447
11  emacs                               0x00000001000eaa8c funcall_subr + 299
12  emacs                               0x00000001000ea16f Ffuncall + 653
13  emacs                               0x000000010011c258 exec_byte_code + 1563
14  emacs                               0x00000001000ea114 Ffuncall + 562
15  emacs                               0x000000010011c258 exec_byte_code + 1563
16  emacs                               0x00000001000ea114 Ffuncall + 562
17  emacs                               0x000000010011c258 exec_byte_code + 1563
18  emacs                               0x00000001000ea114 Ffuncall + 562
19  emacs                               0x000000010011c258 exec_byte_code + 1563
20  emacs                               0x00000001000ea114 Ffuncall + 562
21  emacs                               0x000000010011c258 exec_byte_code + 1563
22  emacs                               0x00000001000ea114 Ffuncall + 562
23  emacs                               0x00000001000e9dfd Fapply + 651
24  emacs                               0x00000001000ea16f Ffuncall + 653
25  emacs                               0x000000010011c258 exec_byte_code + 1563
26  emacs                               0x00000001000ea114 Ffuncall + 562
27  emacs                               0x00000001000e9dfd Fapply + 651
28  emacs                               0x00000001000ea16f Ffuncall + 653
29  emacs                               0x000000010011c258 exec_byte_code + 1563
30  emacs                               0x00000001000ea114 Ffuncall + 562
31  emacs                               0x00000001000e9dfd Fapply + 651
32  emacs                               0x00000001000ea16f Ffuncall + 653
33  emacs                               0x000000010011c258 exec_byte_code + 1563
34  emacs                               0x00000001000ea114 Ffuncall + 562
35  emacs                               0x00000001000e9dfd Fapply + 651
36  emacs                               0x00000001000ea16f Ffuncall + 653
37  emacs                               0x000000010011c258 exec_byte_code + 1563
38  emacs                               0x00000001000ea114 Ffuncall + 562
39  emacs                               0x00000001000e9dfd Fapply + 651
40  emacs                               0x00000001000ea16f Ffuncall + 653
0

There are 0 best solutions below