Rstudio: IDE hangs when opening certain Git-managed projects on Windows

Created on 6 Feb 2018  路  3Comments  路  Source: rstudio/rstudio

A number of users have reported issues with RStudio hanging on open with Windows. The general symptoms are:

  1. The IDE surface loads and initially appears to be responsive;
  2. However, attempting to execute any R code fails (the console never prints any output),
  3. Any other actions in the IDE silently appear to do nothing,
  4. Attempts to close the IDE also fail.

@andrie experienced this with one of his projects, and discovered that it seemed to be linked to the usage of Git -- the hang goes away once the .git folder is deleted.

Opening RStudio with Project Explorer, it seems as though RStudio is stuck in a loop querying the project with git status, while the asynchronous package completer tries to run as well. Note that the asynchronous package completer never finishes running, but git instances keep getting repeatedly launched.

screen shot 2018-02-05 at 4 31 54 pm

The error logs have this:

06 Feb 2018 00:32:37 [rsession-kevin] ERROR system error 5 (Access is denied) [path=C:/Users/kevin/Desktop/checkpoint/.git/index.lock]; OCCURRED AT: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375; LOGGED FROM: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375
06 Feb 2018 00:34:42 [rsession-kevin] ERROR system error 2 (The system cannot find the file specified) [path=C:/Users/kevin/Desktop/checkpoint/.git/index.lock]; OCCURRED AT: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375; LOGGED FROM: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375

Attempting to manually execute git status does succeed when launched from the command line, so it's not immediately obvious what the issue might be (unless it's the collision between these child processes that is somehow the culprit).

bug reproducible verified

Most helpful comment

It looks like this issue can occur if the .git folder is no longer marked as a Hidden folder by the Windows filesystem. In that case, RStudio seems to get stuck in a loop where:

  1. RStudio attempts to invoke git status,
  2. This causes an index.lock file to be created,
  3. The file monitor sees this, and opens a connection to the file,
  4. The duplicate attempts to open the file interfere, and this seems to cause a kind of deadlock.

I can reproduce this by removing the Hidden attribute on any Git-managed project. I'm guessing this can happen when directories are transferred using mechanisms that don't preserve these Windows-specific filesystem attributes.

We should avoid relying on the system hidden attribute and intentionally screen the .git (and .Rproj.user) folders out from the file indexer.

All 3 comments

It looks like this issue can occur if the .git folder is no longer marked as a Hidden folder by the Windows filesystem. In that case, RStudio seems to get stuck in a loop where:

  1. RStudio attempts to invoke git status,
  2. This causes an index.lock file to be created,
  3. The file monitor sees this, and opens a connection to the file,
  4. The duplicate attempts to open the file interfere, and this seems to cause a kind of deadlock.

I can reproduce this by removing the Hidden attribute on any Git-managed project. I'm guessing this can happen when directories are transferred using mechanisms that don't preserve these Windows-specific filesystem attributes.

We should avoid relying on the system hidden attribute and intentionally screen the .git (and .Rproj.user) folders out from the file indexer.

This makes sense, and thank you for looking into the issue. In my case, the project was shared by Microsoft OneDrive, so this would have been the cause of the change in hidden status of the .git folder.

I can also confim that if I manually set the properties of the .git folder to hidden, the problem goes away.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richardohrvall picture richardohrvall  路  3Comments

curtis999 picture curtis999  路  3Comments

verajosemanuel picture verajosemanuel  路  3Comments

Iuiu1234 picture Iuiu1234  路  3Comments

gtritchie picture gtritchie  路  3Comments