unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Mikhail P <mikpom@fastmail.com>
Cc: 45256@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#45256: Viewing images over network using TRAMP (errors and unexpected prompts)
Date: Wed, 16 Dec 2020 10:08:08 +0100	[thread overview]
Message-ID: <87360615l3.fsf@gmx.de> (raw)
In-Reply-To: <461b6a4f-9709-c71b-0ec3-f70d08674c9e@fastmail.com> (Mikhail P.'s message of "Tue, 15 Dec 2020 19:17:28 +0700")

Mikhail P <mikpom@fastmail.com> writes:

> Greetings.

Hi,

> I am experiencing problems with viewing remote images. When resizing
> an image (e.g. by resizing Emacs frame) Emacs occasionally
> (approximately ~30% reproducibility) can prompt ... changed on disk;
> really edit the buffer? which does not make a lot of sense. Regardless
> of my response Emacs outputs errors, lags for several seconds and only
> after that resizes the image.
>
> I am using currently most recent commit on TRAMP repo
> (69844458e33b5dcae53de249d9d82c59a5876055) containing some necessary
> fixes. Prior to these fixes Emacs could occasionally stall on resizing
> remote image and only interruption with C-g could help (or sometimes
> making Emacs completely unresponsive). Also attaching TRAMP debug file
> which I hope exposes the problem.

FTR, this has been merged with the Emacs git master.

> As far as I could understand from my conversation with TRAMP devs
> while working on the fixes there are problems with functions called on
> idle-timer in image mode ... 😬

Well, we see in the debug file the following backtrace:

--8<---------------cut here---------------start------------->8---
  backtrace()
  tramp-send-string((tramp-file-name "ssh" nil nil "horsehop" nil "/storage1/mikpom/wizard_devel/CNV/figs/TCGA_CNV/AT..." nil) "(env QUOTING_STYLE=locale \\stat -c '((/////%N/////...")
  tramp-send-command((tramp-file-name "ssh" nil nil "horsehop" nil "/storage1/mikpom/wizard_devel/CNV/figs/TCGA_CNV/AT..." nil) "(env QUOTING_STYLE=locale \\stat -c '((/////%N/////...")

[...]

  tramp-file-name-handler(file-readable-p "/ssh:horsehop:/storage1/mikpom/wizard_devel/CNV/fi...")
  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])

[...]

  tramp-file-name-handler(verify-visited-file-modtime #<buffer TCGA-02-2485.png>)
  add-text-properties(1 64075 (display (image :type png :data "\211PNG\15\n\32\n\0\0\0\15IHDR\0\0\5\0\0\0\3\300\10\6\0\0\0j\334\324y\0\0\0\4sBIT\10\10\10\10|\10d\210\0..." :scale 1 :max-width 1152 :max-height 884) rear-nonsticky (display) read-only t front-sticky (read-only)))
  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])
18:56:54.633834 tramp-send-string (1) # Remote file error (compat): Forbidden reentrant call of Tramp
--8<---------------cut here---------------end--------------->8---

That is, two calls of timer-event-handler([t 0 1 0 nil image-fit-to-window ...])

image-fit-to-window calls remote file operations,
verify-visited-file-modtime the first time, file-readable-p the second
time. The first call of image-fit-to-window hasn't finished, when the
second call of image-fit-to-window happens one second later. That is
relevant, this situation happens only for slow remote connections (I had
a hard time to reconstruct the scenario).

From my pov, image-fit-to-window must be hardened in order to avoid this
reentrant call. Maybe an internal lock at entry, which is honored by
every next call until the lock is removed.

And at least it shall be wrapped with

(ignore-error 'remote-file-error ...)

in order to masque the situation.

> Thanks,
>
> Mikhail

Best regards, Michael.





  reply	other threads:[~2020-12-16  9:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 12:17 bug#45256: Viewing images over network using TRAMP (errors and unexpected prompts) Mikhail P
2020-12-16  9:08 ` Michael Albinus [this message]
2020-12-16 20:52   ` Juri Linkov
2020-12-17  8:44     ` Michael Albinus
2020-12-17 21:59       ` Juri Linkov
2020-12-18  8:05         ` Michael Albinus
2020-12-18  8:29           ` Juri Linkov
2020-12-18  9:58             ` Michael Albinus
2020-12-19 20:19               ` Juri Linkov
2020-12-22 14:49                 ` Mikhail Pomaznoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87360615l3.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=45256@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=mikpom@fastmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).