RStudio suddenly slow processing

Hi,

I'm running Rstudio Version 1.1.419 with R-3.3.2 on Windows 10.
Starting yesterday the console takes a very long to respond to to process a simple command I use to run. I tried both re-installing R studio and deleting(renaming) the Rstudio-Desktop directory, but that did not solve the problem.

Any thoughts. Thanks.

2 Likes

Do you see this slowness in all RStudio projects, or only certain ones? From a new RStudio session launched in a project where you're seeing this slowness, can you try running and providing the output of:

system("cmd.exe /C dir")
system("cmd.exe /C dir /AH")

Are you by any chance using a remote / networked filesystem (e.g. a remote directory mounted locally)?

I'm not using a networked filesystem, and I'm running the very same script and functions that were perfectly working 2 days ago. It's happening in all RStudio projects, but only in certain functions within the script.
I just run it and got the error 127 (see below).
Thanks.


system("cmd.exe/C dir")
Warning message:
running command 'cmd.exe/C dir' had status 127
system("cmd.exe/C dir/AH")
Warning message:
running command 'cmd.exe/C dir/AH' had status 127


You're missing the spaces between cmd.exe and /C, as wel as dir and /AH. If you copy and paste this text to RStudio it should work:

system("cmd.exe /C dir")
system("cmd.exe /C dir /AH")

Can you elaborate on what you mean, here? Any chance you'd be able to distill this into a reproducible example?

What is this command supposed to help show? I have had basically unusable Rstudio performance on Windows 10 recently.

1 Like

We discovered one issue where Git-managed projects whose .git folder is not hidden for some reason can lead to slowness / hangs within RStudio (usually manifesting as extremely slow time for execution of commands in the console).

Executing that shows the files within the (project) directory, as well as hidden files in that directory. It's a way for me to see if this could be the culprit in the slowness observed (does a .git directory exist, and if so, is it hidden?)

3 Likes

@tjmahr can you elaborate on the slowness you're seeing? Is it only in certain projects, or all of them? Is the slowness manifesting as e.g. 'laggy typing', or is it more like the R console takes a long time to respond to submitted commands?

You can see below the output I got when I run both commands:

system("cmd.exe /C dir")
El volumen de la unidad C es Acer
El n£mero de serie del volumen es: F4BA-4F27

Directorio de C:\Users\pau_k\Documents\OPL\Experiments\EXPERIMENT 1 - Trastuzumab Resistance - TiOx\ClassI pSites\R\180212

13/02/2018 10:59 .
13/02/2018 10:59 ..
13/02/2018 10:29 25,159 .Rhistory
21/12/2017 14:02 10,652,886 171221_Tot_TiOx_N1_N2_N3_PGA.txt
13/02/2018 11:00 69,881 180212_Limma TiOx_N1_N2_N3.R
12/02/2018 15:32 15,277,681 180212_Tot_TiOx_N1_N2_N3_PGA.txt
18/01/2018 14:56 22,377 180213_TiOx_VennDiagram.R
13/02/2018 10:59 15,652,344 180213_Tot_TiOx_N1_N2_N3_PGA.txt
13/02/2018 10:28 39,820 180213_volcano_ggplot_TiOx.R
7 archivos 41,740,148 bytes
2 dirs 784,452,534,272 bytes libres

system("cmd.exe /C dir /AH")
El volumen de la unidad C es Acer
El n£mero de serie del volumen es: F4BA-4F27

Directorio de C:\Users\pau_k\Documents\OPL\Experiments\EXPERIMENT 1 - Trastuzumab Resistance - TiOx\ClassI pSites\R\180212

No se encuentra el archivo
Warning message:
running command 'cmd.exe /C dir /AH' had status 1


Indeed, It's happening in all projects, and it seems to be the R console taking more time to respond to submitted commands (especially in functions with loops) which were running normally beforehand.
Thanks.

Sure, it's Rstudio that's the slow one for me. I get a really long spinner on the package pane when it tries to list packages. It get really long spinner when I try to check for package updates (the three dots on the Update Packages screen) or try to close Rstudio. It hits some projects a lot harder than others. The only fix I have found is to add the processes Rterm.exe, rsession.exe, rstudio.exe, git.exe to the list of Windows Defender Exclusions.

3 Likes

@PAULA_Goal: It looks like my hypothesis related to the slowness being caused by git did not hold out here. Would you be willing to test a daily build from https://dailies.rstudio.com and let me know if you're still encountering this issue? Or, you might also try RStudio v1.0 and let us know if you still see the same slowness there: https://support.rstudio.com/hc/en-us/articles/206569407-Older-Versions-of-RStudio

@tjmahr: Thanks for following up. Does your workaround indeed fix the issue in your case? If so, it feels like this could be outside of RStudio's control.

I think so... It's weird. I did a system refresh and reinstall R/Rstudio, and still had the problem. I hope this helps others. See also

3 Likes

@tjmahr :thank you! You are my savior!! This problem has crippled my work on two Windows10 PCs. I had no choice but to use a mac in my office. Following your instructions, everything is fine now.

Standard antivirus crippling RStudio is crazy.

3 Likes

Hi,
@tjmahr

How is this fix holding up for you? I'm struggling with the same random RStudio lag problem. It wasn't clear to me from your reply whether the fix continued to work or not. If it is still working, could you specify where to find the R and github exe files you added to Windows Defender exclusions? Also, did you have to restart RStudio and/or the computer before the changes took effect?

Thanks very much for your help with this.

I think the solution still works. I didn't exclude any files, but rather I excluded the processes.

Having the same problem. It seems the antimalware service executable windows defender antivirus service can stop RStudio from working (save button non-responsive in RStudio - couldn't even save or shut down RStudio - thankfully I could copy and paste my code to somewhere else but environment was lost)

I will try adding to windows defender exclusions.

I had a similar issue:
Very long delays when clicking the button on the Git tab save a commit, the time it took to show the changes in the commit window, and the time it took to push a commit once the commit was saved.
Disabling real time monitoring in both Windows Defender and Malwarebytes fixed it.

@kevinushey commenting here as per request at https://twitter.com/kevin_ushey/status/978658045801783296

At work I had to migrate from windows 7 to windows 10 two days ago. Since then I am seeing much of what is described in this thread. Noteworthy difference is that windows defender is disabled on our system (McAffee instead). The problem is present regardless of git enabled repositories or simple projects. It also does not matter whether they are located on a network drive or locally. I am on R 3.4.4 (2018-03-15) -- "Someone to Lean On", windows 10 - 64 bit. Latest version of RStudio 1.1.442 as well as yesterdays daily build are pretty much unusable. I have reverted back to RStudio v1.0.153 which performs better, but is still laggy every once in a while. Maybe it is worth investigating what changed between 1.0.153 and later versions.

I have issued a ticket with our company IT, but so far no response.
I will report back whenever we get this solved.

Some users have reported that the slowness is alleviated if the HOME environment variable is set to a local path, e.g.

HOME=C:\Users\<me>

Does this make a difference in your case?

I'd also be curious to see a copy of the event log when the slowness occurs. This can be done by pressing Ctrl + `. You can then take a screenshot and let us know if any of the bars that show up are very 'long' (as that request might be associated with the slowness)

@kevinushey

RStudio 1.1.442

Sys.getenv() shows
HOME C:/Users/tim.appelhans/Documents
so I guess that's not a problem here.

screenshot of the event log with RStudio 1.1.442 (one command - plot(1:10) - sent from editor to console):

same command with RStudio 0.99.903

Anything suspicious?

Thanks! It's very surprising to me that the modify_document_properties calls are taking so long; those are RPC requests made to synchronize document properties (e.g. the cursor location) with the server.

These get triggered somewhat eagerly -- for example, after moving the cursor and then idling, the cursor position will get synchronized with the server. I wonder why that's taking longer in your case?

Are you working with files, or a project, living on a network share or something similar? Or might your RStudio installation live on a networked filesystem?