8

I am getting strange and annoying behavior in one (yes, only one) of my RStudio projects. Whenever I restart the R session within this project, I can no longer save any of the files, and when I try to (or RStudio tries to automatically) I get a popup error saying "The system cannot find the file specified" and I have to reopen the project and all of the R scripts.

I looked at the log file, and I see a lot of the following error:

07 Oct 2015 00:52:05 [rsession-Mark] ERROR system error 5 (Access is denied) [path=C:/Users/Mark/GoogleDrive/Research/CEQUAL_event/.Rproj.user/5E5F98D9/sdb/s-26E44539/lock_file];
OCCURRED AT: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:308;
LOGGED FROM: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:308

It looks like the problem may be in the .Rproj.user folder. So I deleted that and let RStudio regenerate it, but the behavior started right back up again.

I am using Windows 7, RStudio version 0.99.441, and R version 3.2.2.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
MarkH
  • 189
  • 1
  • 5
  • 1
    Has this `C:/Users/Mark/GoogleDrive` got something to do with it? Are you syncing this somewhere, or is it a mount of a remote file system? – Jack Wasey Oct 07 '15 at 01:14
  • It's being synced. But so are my other projects. I do see that GoogleDrive says "You do not have permission to sync this file" about the lock file. So perhaps this has something to do with it--unclear if it's cause or effect though. – MarkH Oct 07 '15 at 01:24
  • I'm not sure I can give you a definitive answer, but I would think moving the project, without lock file, to a new directory in your synced filesystem would be a good idea. It sounds very much like a sync issue, but do also check file permissions. Maybe you once did something as root and the sync is changing the ownership or flags, or something. Easiest to just start fresh instead of trying to debug the sync. – Jack Wasey Oct 07 '15 at 01:38

4 Answers4

6

I think @Jack Wasey is right: Google drive locks files during sync. This causes many issues with other programs as well. There are alternatives from companies that do file syncing for a living, such as dropbox, whose clients don't lock files. With google drive you only have the option to use selective sync and exclude every .Rproj.user folder. Once the RStudio's database is corrupted, moving the project out of the Google drive folder won't be enough - you will need to delete/rename it to have RStudio fix its database.

Summary:

  1. Copy contents from all unsaved files to a temp file outside of RStudio (while clicking away the error message every other second)
  2. Quit Rstudio
  3. Pause Google drive syncing
  4. Rename (or move/delete) the hidden .Rproj.user folder in your project
  5. Reopen the project in Rstudio
  6. Exclude the new .Rproj.user folder from syncing with Google drive (Preferences -> sync only these folders)
  7. Remember that Google drive is free / Become an awesome google developer and fix the issue once and for all
jan-glx
  • 7,611
  • 2
  • 43
  • 63
0

May not be related but might be helpful to someone else. I was getting the same error (over and over) and finally realized that I had an R session open from days ago, that had eventually gotten stuck. It was running in the background with a "Fatal Error" message waiting for me to click OK. When I closed that session everything started working again.

Turner
  • 1
0

This was happening to me as well, but curiously only when I was using Project files (.Rproj - not stand alone R scripts). It was driving me crazy.

I found that buried in the settings (Tools -> Global Options -> Git/SVN) there was a setting "Enable Version Control Interface for RStudio Projects). I guess I had turned that option on when I was messing with my settings and then forgot about it since I don't normally use project files.

JBquant
  • 21
  • 1
0

What worked for me was I noticed DescTools package I installed caused it, though it served the purpose I installed it - fetched me mode value without going through mode functions. I then deleted the line I got the install.package, re-saved the project (ctrl S) and I could knit it.

Bottom line, read the error message soon as the box pops up, it's going to give you a hint of what line is causing the issue.

I hope this works. Enjoy