01-21 08:41:59: Warning in file(open = "w+") :
cannot open file '/tmp/Rtmp59oXbx/Rf6d491630fdb4': No such file or directory
01-21 08:41:59: Warning: Error in file: cannot open the connection
01-21 08:41:59: [No stack trace available]
My questions:
any idea why this happens, and how I could avoid it?
alternatively, it would be enough that the application, upon this error, dies instead of keeping running (so that a new one is started automatically). Can this be accomplished?
We are going to need more information to help you. Where are you deploying your app? Does your app run locally? What is the code of your app? Do you have checked you have proper permissions in your apps folder?
The app is running on an AWS instance with Amazon Linux, and it's standalone (no shiny server: I just run Rscript -e "shiny::runApp()" and manage the instances via pm2).
Then it's served through an haproxy instance (in this case, there's only one server in the backend).
The code is quite large, so I'm not sure what to tell you, but if you have questions in particular I'll be happy to specify.
As for permissions, yes, all seems in order (besides, the error is for a file in /tmp, which should not have any problems of that kind).
I found a reference in some Stack Exchange question, saying that the temporary file (created directly by Shiny) was deleted for some reason, but I don't see how it could happen in my case.
I think the problem happens when the app has been idling for a while (in this case, the latest log entry before the ones I posted above are from about 24 hours earlier). Does that help?
I'm not sure, since I'm not familiar with the deployment approach you are using, I just use shiny-server for deployment. (Also in a EC2 AWS instance but with Ubuntu because it's officially supported by shiny server).