Hi Michael, 

Many thanks for your quick reply and continuous support! 

Best regards, 
Sandro 
> On 25. Apr 2023, at 10:59, Michael Albinus <michael.albi...@gmx.de> wrote:
> 
> Sandro Romanzetti <roman.san...@gmail.com <mailto:roman.san...@gmail.com>> 
> writes:
> 
>> Dear Tramp Developers,
> 
> Hi Sandro,
> 
>> I am trying to execute the following R code from within a org-mode
>> file but it take more than 60 seconds to get the results back on my
>> screen. For this reason I usually login to my remote server and start
>> emacs from the terminal. In that case I have no delays whatsoever.
>> 
>> Here is the source code block:
>> 
>> #+begin_src R :session myplot :results value :colnames yes :exports results
>> library(tidyverse)
>> T<-tibble(x=(1:20),y=(1:20))
>> T
>> #+end_src
>> 
>> I attach the debug message (using tramp-verbose 10). I would be very 
>> grateful if you could give me any hint on how to solve this issue.
> 
> Thanks. I've tried to analyze the traces. Note that I don't use R, so I
> must guess something.
> 
> The traces don't show any remote process call. So I assume that there is
> already a remote R process, running as REPL loop.
> 
> The majority of the Tramp actions is about the remote file
> "/tmp/R-Gpow4E". It doesn't exist at the beginning, and Tramp marks it
> as such in the cache:
> 
> --8<---------------cut here---------------start------------->8---
> 00:52:36.548413 tramp-send-command (6) # test -e /tmp/R-Gpow4E 2>/dev/null; 
> echo tramp_exit_status $?
> 00:52:36.591744 tramp-wait-for-regexp (6) #
> tramp_exit_status 1
> ///1b9b06976240a21aa1381a07a40053bd#$
> 00:52:36.591976 tramp-get-connection-property (7) # process-buffer nil; cache 
> used: nil
> 00:52:36.592165 tramp-set-file-property (8) # /tmp/R-Gpow4E file-exists-p nil
> --8<---------------cut here---------------end--------------->8---
> 
> But then, your session waits that this file exists:
> 
> --8<---------------cut here---------------start------------->8---
> 00:52:36.876143 tramp-get-file-property (8) # /tmp/R-Gpow4E file-exists-p 
> nil; inhibit: 60; cache used: t; cached at: 00:52:36
> 00:52:37.137672 tramp-get-file-property (8) # /tmp/R-Gpow4E file-exists-p 
> nil; inhibit: 60; cache used: t; cached at: 00:52:36
> 
> [...]
> 
> 00:53:36.565685 tramp-get-file-property (8) # /tmp/R-Gpow4E file-exists-p 
> nil; inhibit: 60; cache used: t; cached at: 00:52:36
> 00:53:36.831883 tramp-get-file-property (8) # /tmp/R-Gpow4E file-exists-p 
> undef; inhibit: 60; cache used: nil; cached at: 00:52:36
> --8<---------------cut here---------------end--------------->8---
> 
> For 60 seconds, Tramp reports the non-existence according to its
> cache. Then the cache expires, and Tramp does a real check:
> 
> --8<---------------cut here---------------start------------->8---
> 00:53:36.881497 tramp-send-command (6) # test -e /tmp/R-Gpow4E 2>/dev/null; 
> echo tramp_exit_status $?
> 00:53:36.930700 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
> ///1b9b06976240a21aa1381a07a40053bd#$
> 00:53:36.931118 tramp-get-connection-property (7) # process-buffer nil; cache 
> used: nil
> 00:53:36.931540 tramp-set-file-property (8) # /tmp/R-Gpow4E file-exists-p t
> --8<---------------cut here---------------end--------------->8---
> 
> Tramp knows about a stale cache when it starts a remote
> process. However, when a remote process is running, and a client program
> (your R session) sends statements which change the existence of a remote
> file, Tramp cannot know this. Your client program must inhibit Tramp's
> cache while doing so.
> 
> I recommend you to contact the org maintainers about. At a proper place,
> where the code waits for the existence of the tmpfile, they shall
> let-bind remote-file-name-inhibit-cache to t.
> 
>> Kind regards,
>> Sandro Romanzetti
> 
> Best regards, Michael.

Reply via email to