Restarting Rstudio Server in Docker: Avoid Error Message

rstudio

#1

I'm running Rstudio (preview) in a Docker container on macOS and Windows. I'm using a bash script to make it easier to start/stop the container. This is working very nicely, except that each time I stop (kill) the docker process and start it back up again, Rstudio shows an error message that the "session was abnormally terminated".

Is there a way to avoid this message from showing up? e.g., by removing a file in the .rstudio directory before startup?


image


#2

Yes, there is. There's a file called session-persistent-state in ~/.rstudio/sessions/active/session-XXXXXXXX, with a flag:

abend="1"

If you change that 1 to 0, it'll turn off the warning.

Hope this helps!


#3

Excellent! Thanks @jonathan!

In case someone ever needs something similar ... I used the following code in the script to search-and-replace abend="1" to abend="0"

find ~/.rstudio/sessions/active/*/session-persistent-state -type f | xargs sed -i '' -e 's/abend="1"/abend="0"/'


#4

@jonathan I wonder if the following might be a related problem. I'm using rstudio (open source) in a docker container running on my laptop. I access rstudio from different ports (e.g., 8787 and 8788). The 2nd instance also has to reset the 'abend' variable to avoid the "abnormally" terminated message.

When running on > 1 port, now and then without any pattern that I can determine, the follow error pops up and the file I'm editing cannot be saved. Also, a browser refresh dumps the rstudio project. Any ideas or suggestions? Is this perhaps a built-in limitation in the open-source version of Rstudio?

image

FYI I'm running the Rstudio server preview version (1.2.907) in the container and this would happen with the previous preview version as well. Launch scripts for the docker container are available in repo linked below:

macOS: https://github.com/radiant-rstats/docker/blob/master/launch-mac.command