RStudio server - Hangs when switching projects - r

I am currently running RStudio via a server installation that I only partially maintain. I am working with some fairly large data sets and models (> 9 million rows of 611 variables). When I try to switch projects, RStudio hangs when loading the project (it says "Switching projects to..." at the top) or, if it loads, takes forever.
RStudio works otherwise while attempting to switch projects, but menus and the like do not work.
I have searched thoroughly for a fix to no avail. How would I go about troubleshooting (or, ideally, fixing) the problem?
RStudio is running on a linux (Open SuSE) VM.
Thanks in advance.
EDIT: Per this thread: https://stackoverflow.com/a/15373596/3469671, I deleted .rstudio from my home directory and that seemed to free things up. Is there some setting I can change to facilitate the loading of larger projects?

Per this thread, I deleted .rstudio from my home directory and that seemed to free things up.
As a practice, I learned to stop saving my workspace while it was loaded with data and included steps within projects to save and load prepared data.

Related

Global variables not saved after executing R code

Recently I swapped my personal PC with admin rights to my employee's PC, where we use AD to log in and where I do not hold admin rights.
Since that event, I have trouble running my R code. I currently develop Shiny app. Each time I click "Run app", two things appear to behave differently versus my old setup.
First of all, I can run app only once - after that, the Rstudio is busy forever, suppressing me from running app again, accessing data frames created by my app and so on. So after each test of some changes, I literally have to reset entire RStudio.
Secondly, despite the fact that I have set my working directory to "C:/Users/mylogin/Documents", after restarting R, there are no global variables visible, event after saving workspace image. I used to use global variables to debug my app after closing it. Of course I can rewrite entire code to, for example, dump all the tables to different files.
My question is: is it possible, that this behavior is related to not having admin rights on my current PC? Or is it related to another issue and if so - may someone provide me some help in that matter? I have little to no knowledge about debugging Rstudio.
Setup: Win 10 64bit, R version 4.0.2 (2020-06-22) Rstudio desktop, 1.3.1093, Apricot Nasturtium.
For future generations: the problem perished, without any particular reason, quite frustrating that we will never know the answer.

R Studio incredibly slow only after I connect to my work VPN?

I have R Studio on Windows. It works fine before I connect to the internet through my VPN. After I connect commands start to hang, autocomplete can take forever, and simple operations like 4 + 4 can take one minute or more.
I have a feeling the studio is making connections under the hood. I would like to disable all of these connections no matter what.
I have experienced the same thing - I am assuming your actual work is on a file server and not local. I found the culprit in my case to not be RStudio directly, but rather the RStudio project file. RStudio will create a generally small, hidden folder in the directory named .Rproj.user with some settings. This, living on the file server, caused constant read/writes through my VPN connection.
I unfortunately had to either (a) move projects off the file server into a local copy (not bad since I can use a company GitLab), or (b) delete the .Rproj and .Rproj.user folders from the project directory on the server and use here::here() or something like that as a work around in my workflow.
As another possibility, I have seen installations of R itself done onto a personal server drive instead of locally. This has been done to avoid needing administrator privileges to install. This is not a great idea and can also result in extremely slow performance through a VPN connection. You can check to see where R is installed as well. Sounds like this is not the problem though based on what you described.
Maybe it is something else, but this is what I found last week for me based on a very similar experience.

R studio not responding

My RStudio is opening multiple processes(opening R Studio in different windows) when I open just one. I am not able to open any project. It becomes unresponsive. I tried using in compatibility mode, running as admin and also uninstalled. But still,(here's the image) the same problem persists. Can someone please help me?
Before you reinstall everything, which may take a lot of time, it is worth removing application data, which is a cache R keeps of last sessions etc. It involves settings such as information from last session, etc which RStudio tries to reopen every time you open it.
For app data, look under your user folder which must be somewhere like
c:\Users\<your_user_here\AppData\Local
c:\Users\<your_user_here\AppData\Local\LocalLow
c:\Users\<your_user_here\AppData\Roaming
Delete every subfolder called R, RStudio-Desktop or RStudio under these folders. Don't worry, you won't lose your source program files and projects. It may help you recover everything without having to start over from scratch.

Rstudio is painfully slow

Suddenly, Rstudio is painfully slow, and now it is unusable. This means, I open it up and there is a lag of several seconds if I type anything. I have explored all the options I can come up with:
1. re-installing both R and Rstudio (although I am not 100% sure I could remove all components),
2. trying to reset settings.... the obvious things such as clearing the workspace and the console.
The size of my data is negligible. I cannot think of anything else.... any ideas?
The only observation i can make that shows something could be wrong with the configuration is (sometimes), I see "gctorture false" as a value in the environment.
Just a guess, but ?gctorture says
Provokes garbage collection on (nearly) every memory allocation.
Intended to ferret out memory protection bugs. Also makes R run
_very_ slowly, unfortunately.
which sounds about right for your problem! You could try
gctorture(FALSE)
If that speeds things up, then look for somewhere that this might have been set, e.g., in a .Rprofile (current working directory, or your user home directory, or the installation directory of R; see ?.Rprofile) and make sure that you start R without loading any .Rhistory or .RData files (again in the working directory, your home directory, etc.)
I had a RStudio project with Git Version Control and then it became very slow. I solved the problem by removing the Git Version Control

RStudio freezes on "saving workspace image," previously saved .RData file disappears

First, I've also posted this question on the RStudio Support page. If I get a response there, I will post it here for all to see (and vice versa).
I'm enjoying RStudio but am having trouble using Rprojects to save model outputs. I'm running sets of models that take ~1 day to run, so this is really setting me back. This is on an iMac running 10.9.5 (Mavericks).
Here's what happens:
I close the project and allow the "saving workspace image" to go through. (This is taking ~15 min, and the Rdata files are 6GB - this seems surprisingly large to me).
Often there is no problem upon reopening, the Rdata files are restored, and I see the objects I've created in the Global Environment pane. I run another model (or set of them), and close the project again. RStudio now gets hung up on "saving workspace image." Eventually, the wheel showing that this is active stops turning. Sometimes the mouse disappears from the screen and the entire computer freezes.
I either force RStudio to close, or force the computer to shutdown. When I restart and open RStudio, then load the Rproject, the Global Environment is empty. In the Files pane, there are no .RData files shown.
When I check the Rproject directory in Finder, there are multiple .RDataTmp (hidden) files. I'm not clear whether I can use any of them to recover my data, or how to attempt to load them in RStudio.
Solutions I've tried so far:
Updating everything, including R, RStudio, and Safari, per another post on RStudio Support.
Disabling my syncing program (SugarSync) from updating .Rproj.user file, also after reading a post there.
Enabling access for RStudio in the Privacy/Security settings.
I haven't been able to find any other possible solutions, and I am growing frustrated with testing this out, as it seems to happen only intermittently and (sigh) after the problem seems revolved, such that I've run a whole bunch of models and have a good deal of data to lose! This makes me wonder whether (a) the universe is simply cruel, or (b) it's the large file size that is causing the problem. The other option is (c) both.
I read elsewhere on RStudio Support that file compression can be enabled, but that this will slow the process of saving. Since it's already taking quite a long time to save upon closing the project and I'm not clear on why it might help, I'm hesitant to enable file compression until I know more.
Thanks for your help,
MK

Resources