Skip to content

Warning

This is as a Lab Notebook which describes how to solve a specific problem at a specific time. Please keep this in mind as you read and use the content. Please pay close attention to the date, version information and other details.

RStudio Server Shows Blank or Gray Screen, or error "Status code 502"

When using RStudio Server through OnDemand, some users have found that the job will start normally, but when connecting from OnDemand, a tab with a blank or gray screen shows up instead of RStudio Server. Sometimes, RStudio Server will load successfully from this screen. Please wait at least a full minute on this screen before proceeding to the solution below.

Resolving

However, if you notice that the gray screen persists after one minute of waiting, or you receive the error "Status code 502 returned by RStudio Server when executing 'client_init'" it is possible that RStudio Server is stuck trying to load. As a workaround, sometimes reloading the tab and waiting another minute can work.

Otherwise, clearing RStudio's temporary files stored at ~/.local/share/rstudio can fix the issue. Note that this will likely reset your RStudio session, so you may need to reopen previous projects and files and could lose any unsaved work.

To do this, we recommend moving the files to a backup using a command like

1
mv ~/.local/share/rstudio ~/.local/share/rstudio.backup

Trying to load RStudio Server should work again (though you may need to wait a minute or two for the gray screen to go away as described above).

Preventing

While we are not sure what exactly causes this, our guess is that either 1) RStudio Server's temporary files have been corrupted after a job shut down incorrectly or 2) RStudio Server has saved large files from the last time it was open and tries to reload them. We highly recommend that you:

  1. Shut down your RStudio session instead of letting your job time out in OnDemand. This is done by clicking the power button in the top right corner of RStudio Server.
  2. Ensure that RStudio Server does not save your workspace data on exit. This can be accomplished by clicking the "Tools" menu and selecting "Global Options". In the default "General" pane under the "Workspace" header ensure that "Restore .RData into workspace at startup:" is unchecked and that "Save workspace to .RData on exit:" is set to Never.