You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Constant errors when editing a file synced to Google Drive #7131
RStudio Edition : Desktop
RStudio Version : 1.3.959
OS Version : Windows 10
R Version : 4.0.1
Steps to reproduce the problem
Edit a file that is saved in a folder that the Google Backup and Sync app is syncing to Google Drive.
Describe the problem in detail
Repeatedly, you will get an error that says The process cannot access the file because it is being used by another process:
Less commonly, you'll get an error that says The file [filename] has changed on disk. Do you want to reload the file from disk and discard your unsaved changes?:
#3837 's wording or comments suggests a belief that it would fix more than just Dropbox. It does not fix this problem with Google Drive.
This is the only software I use that has so many problems with Google Drive. It is highly desirable for RStudio to be compatible with Google Drive as it provides a recovery option for data loss in cases where version control cannot help, including between check-ins/pushes or if the user does not use version control.
Describe the behavior you expected
Editing a file in a folder synced by Google Drive creates no errors.
changed the title [-]When editing a file, RStudio repeatedly has errors when syncing with Google Drive [/-][+]Constant errors when editing a file synced to Google Drive [/+]on Jun 15, 2020
Internal note: this likely occurs because RStudio's autosave (which saves files to the project .Rproj.user folder) is attempting to access files currently read and locked by Google Drive.
We could also try alleviating this by allowing for a retry timeout when we're attempting to open a file handle.
2nd internal note: @kevinushey would this solution affect files outside of a project as well? I haven't been able to consistently reproduce this with just autosave, but I can consistently do so by repeatedly typing and saving fast enough till Google Sync and I have been in conflict (not a realistic scenario, but it forces the issue).
@ronblum: I believe this would affect files opened both inside and outside a project, as in each case files within the project's .Rproj.user will need to be updated.
pResult = new boost::iostreams::stream<file_descriptor_source>(fd);
We could potentially resolve this in a couple ways. If we see this particular error, we could:
Wait a small amount of time, and then try again to re-open the file;
Try also opening the file using GENERIC_READ | GENERIC WRITE (although this is more dangerous, since we could then end up attempting to read a file at the same time a process is trying to write to it)
It's not autosave—turning it off just simply stops it being a frequent issue. We are seeing this issue intermittently with Dropbox on manual save and with all autosave off, at ~ same frequency as reported here.
Dropbox version 104.4.75, Windows 10 x64 (build 17763), R Studio 1.3.1073 and R 4.0.2.
Some sort of exponential back-off process variation on 1 would seem to me to be the best solution.
The problem is that the directory .Rproj.user is required to exist within the project source tree. The .Rproj.user is not compatible with network drives. My guess is that RStudio uses git or something similar within this directory. Git is not compatible with network drives as it relies on specific checksumming behavior. There is a trivial fix that has been suggested but complete ignored by Posit/RStudio folks. If we had the option to place this directory outside of the project tree, these problems would disappear. This directory is only there to cache information. You can delete it and it will be recreated in the next session. Therefore, it does not need to be in the project tree. It could, for example, exist in our home directories or in scratch space somewhere. I cannot understand why this is not an option.
This still seems to be an issue. My solution is to close Google Drive before I start working on an R Project. I'll then start google drive again to sync everything once I'm finished working on the project.
This should be fixed in one the latest daily builds of the release in progress, Cranberry Hibiscus 2024.07.0. If anyone would be willing to try it out, it would be much appreciated. Note that these builds are meant for testing purposes only, not production.
Activity
[-]When editing a file, RStudio repeatedly has errors when syncing with Google Drive [/-][+]Constant errors when editing a file synced to Google Drive [/+]kevinushey commentedon Jun 15, 2020
Internal note: this likely occurs because RStudio's autosave (which saves files to the project
.Rproj.userfolder) is attempting to access files currently read and locked by Google Drive.We could also try alleviating this by allowing for a retry timeout when we're attempting to open a file handle.
ronblum commentedon Jun 15, 2020
2nd internal note: @kevinushey would this solution affect files outside of a project as well? I haven't been able to consistently reproduce this with just autosave, but I can consistently do so by repeatedly typing and saving fast enough till Google Sync and I have been in conflict (not a realistic scenario, but it forces the issue).
kevinushey commentedon Jun 15, 2020
@ronblum: I believe this would affect files opened both inside and outside a project, as in each case files within the project's
.Rproj.userwill need to be updated.kevinushey commentedon Jun 22, 2020
These errors are likely coming from here:
rstudio/src/cpp/shared_core/FilePath.cpp
Lines 1387 to 1403 in 18cbf55
We could potentially resolve this in a couple ways. If we see this particular error, we could:
GENERIC_READ | GENERIC WRITE(although this is more dangerous, since we could then end up attempting to read a file at the same time a process is trying to write to it)matthewberryman commentedon Sep 4, 2020
It's not autosave—turning it off just simply stops it being a frequent issue. We are seeing this issue intermittently with Dropbox on manual save and with all autosave off, at ~ same frequency as reported here.
Dropbox version 104.4.75, Windows 10 x64 (build 17763), R Studio 1.3.1073 and R 4.0.2.
Some sort of exponential back-off process variation on 1 would seem to me to be the best solution.
25 remaining items
cchen22 commentedon Jun 12, 2023
Can anyone let me know the best solution for this problem with Google Drive by 2023? Thanks!
gdickens commentedon Aug 25, 2023
Would like to know this too. Has been a constant problem for me.
thk686 commentedon Dec 1, 2023
The problem is that the directory .Rproj.user is required to exist within the project source tree. The .Rproj.user is not compatible with network drives. My guess is that RStudio uses git or something similar within this directory. Git is not compatible with network drives as it relies on specific checksumming behavior. There is a trivial fix that has been suggested but complete ignored by Posit/RStudio folks. If we had the option to place this directory outside of the project tree, these problems would disappear. This directory is only there to cache information. You can delete it and it will be recreated in the next session. Therefore, it does not need to be in the project tree. It could, for example, exist in our home directories or in scratch space somewhere. I cannot understand why this is not an option.
gdickens commentedon May 15, 2024
This still seems to be an issue. My solution is to close Google Drive before I start working on an R Project. I'll then start google drive again to sync everything once I'm finished working on the project.
Obviously this isn't ideal.
ronblum commentedon Jun 24, 2024
This should be fixed in one the latest daily builds of the release in progress, Cranberry Hibiscus 2024.07.0. If anyone would be willing to try it out, it would be much appreciated. Note that these builds are meant for testing purposes only, not production.
gtritchie commentedon Jun 25, 2024
Note that the fix requires configuring the project to store
.Rproj.usersomewhere other than the cloud drive, see #14875.ronblum commentedon Jul 9, 2024
Closing as fixed. If anyone still runs into this issue, please let us know!