Mikhail P <[email protected]> writes:
> Greetings,
Hi Mikhail,
> After that, on resizing the window with image or the whole frame Emacs
> stalls. The hang occurred from 10:29 till 10:35 (as seen from
> timestamps in attached file) when I interrupted it with C-g.
Thanks for the debug info. It explains what happens, best seen in the
backtrace.
> 10:35:15.924058 tramp-accept-process-output (10) #
> backtrace()
> tramp-signal-hook-function(quit nil)
> accept-process-output(#<process *tramp/ssh horsehop*> nil nil t)
> tramp-accept-process-output(#<process *tramp/ssh horsehop*>)
[...]
> file-readable-p("/ssh:horsehop:/storage1/mikpom/wizard_devel/CNV/fi...")
> image-toggle-display-image()
> image-fit-to-window(#<window 3 on TCGA-02-2485.png>)
> apply(image-fit-to-window #<window 3 on TCGA-02-2485.png>)
> timer-event-handler([t 0 1 0 nil image-fit-to-window (#<window 3 on
> TCGA-02-2485.png>) idle 0])
> accept-process-output(#<process *tramp/ssh horsehop*> nil nil t)
> tramp-accept-process-output(#<process *tramp/ssh horsehop*>)
[...]
> file-readable-p("/ssh:horsehop:/storage1/mikpom/wizard_devel/CNV/fi...")
> image-toggle-display-image()
> image-fit-to-window(#<window 3 on TCGA-02-2485.png>)
> apply(image-fit-to-window #<window 3 on TCGA-02-2485.png>)
> timer-event-handler([t 0 1 0 nil image-fit-to-window (#<window 3 on
> TCGA-02-2485.png>) idle 0])
> accept-process-output(#<process *tramp/ssh horsehop*> nil nil t)
> tramp-accept-process-output(#<process *tramp/ssh horsehop*>)
[...]
> file-readable-p("/ssh:horsehop:/storage1/mikpom/wizard_devel/CNV/fi...")
> image-toggle-display-image()
> image-fit-to-window(#<window 3 on TCGA-02-2485.png>)
> apply(image-fit-to-window #<window 3 on TCGA-02-2485.png>)
> timer-event-handler([t 0 1 0 nil image-fit-to-window (#<window 3 on
> TCGA-02-2485.png>) idle 0])
> accept-process-output(#<process *tramp/ssh horsehop*> nil nil t)
> tramp-accept-process-output(#<process *tramp/ssh horsehop*>)
and so on. Obviously, the idle timer image-fit-to-window is called, and
it doesn't finish within the image-auto-resize-on-window-resize time
frame (1 second). So the next idle timer is called on top, which also
doesn't finish in time, etc pp. This confuses Tramp.
I have prepared a patch for tramp-sh.el (appended), which shall prevent
this scenario. Could you pls try, whether this patch fixes your problem?
> -Thanks,
>
> Mikhail
Best regards, Michael.
*** /tmp/ediffPKriI6 2020-12-10 13:04:41.084502477 +0100
--- /home/albinus/src/tramp/lisp/tramp-sh.el 2020-12-10 13:00:46.909930195 +0100
***************
*** 5186,5195 ****
;; No need to restore a trailing newline here since `tramp-send-string'
;; makes sure that the string ends in `tramp-rsh-end-of-line', anyway.
(setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))
! ;; Send the command.
! (tramp-message vec 6 "%s" command)
! (tramp-send-string vec command)
! (unless nooutput (tramp-wait-for-output p))))
(defun tramp-wait-for-output (proc &optional timeout)
"Wait for output from remote command."
--- 5186,5202 ----
;; No need to restore a trailing newline here since `tramp-send-string'
;; makes sure that the string ends in `tramp-rsh-end-of-line', anyway.
(setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))
! ;; Send the command. It could be started inside a timer which
! ;; runs another command, so we prevent this.
! (if (tramp-get-connection-property p "locked" nil)
! (tramp-error vec 'file-error "Forbidden reentrant call of Tramp")
! (unwind-protect
! (progn
! (tramp-set-connection-property p "locked" (null nooutput))
! (tramp-message vec 6 "%s" command)
! (tramp-send-string vec command)
! (unless nooutput (tramp-wait-for-output p)))
! (tramp-flush-connection-property p "locked")))))
(defun tramp-wait-for-output (proc &optional timeout)
"Wait for output from remote command."