best practices windows server and temporary files in r


I noticed in the last month a change in the behavior of long running r session like e.g. plumber of shiny apps in windows (windows 10 and windows 2022 server). Initially the session runs fine but if the shiny/plumber sessions has been in standby mode for some time (no client asked anything e.g. at night). Suddenly the temp files are missing. The strange thing is however is that this started occurring somewhere halfway December while I had not made changes (besides updates of r and r studio and windows update).

The r session will function for everything which does not require the temp files so e.g.


will work but e.g.


does not work

I have spend quite some time on this issue to find best practices how to avoid this behavior on windows server (2020) but I could not find any best practices.

Is this a known issue? are there any remedies/workaround proposed?

the issue is very similar to this stack overflow post:

However this proposed toggle is not available in win server 2022:

The resulting error

Error in file(open = "w+b", encoding = "UTF-8") :
cannot open the connection
Calls: <Anonymous> -> file
In addition: Warning message:
In file(open = "w+b", encoding = "UTF-8") :
  cannot open file 'C:\Users\XXXX\AppData\Local\Temp\2\RtmpIBTQ69\Rf20c9041027a7f': No such file or directory
> sessionInfo()
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2022 x64 (build 20348)

Matrix products: default

[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

time zone: Europe/Paris
tzcode source: internal

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.