Page MenuHomePhabricator

Auto-retry when landing fails due to index.lock presence
Closed, WontfixPublic

Description

I just tried landing something right now, and I got this error 4 times in a row (literally running arc land immediately after each failure):

juner@pu-ws-170  /c/Code/....... (.......)
$ arc land
Landing current branch '.......'.
 TARGET  Landing onto "master", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
 FETCH  Fetching origin/master...
This commit will be landed:

      - 4a4256a .......

Landing revision 'D10305: .......'...
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
Exception
Command failed with error #128!
COMMAND
git checkout "origin/master" --

STDOUT
(empty)

STDERR
fatal: Unable to create 'C:/Code/......./.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

(Run with `--trace` for a full exception trace.)

juner@pu-ws-170  /c/Code/....... (.......)
$ arc land
Landing current branch '.......'.
 TARGET  Landing onto "master", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
 FETCH  Fetching origin/master...
This commit will be landed:

      - 4a4256a .......

Landing revision 'D10305: .......'...
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
Exception
Command failed with error #128!
COMMAND
git checkout "......." --

STDOUT
(empty)

STDERR
fatal: Unable to create 'C:/Code/......./.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

(Run with `--trace` for a full exception trace.)
 INTERRUPTED!  Restoring working copy to its original state.

juner@pu-ws-170  /c/Code/....... (.......)
$ arc land
Landing current branch '.......'.
 TARGET  Landing onto "master", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
 FETCH  Fetching origin/master...
This commit will be landed:

      - 4a4256a .......

Landing revision 'D10305: .......'...
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
Exception
Command failed with error #128!
COMMAND
git checkout "origin/master" --

STDOUT
(empty)

STDERR
fatal: Unable to create 'C:/Code/......./.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

(Run with `--trace` for a full exception trace.)

juner@pu-ws-170  /c/Code/....... (.......)
$ arc land
Landing current branch '.......'.
 TARGET  Landing onto "master", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
 FETCH  Fetching origin/master...
This commit will be landed:

      - 4a4256a .......

Landing revision 'D10305: .......'...
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
 PUSHING  Pushing changes to "origin/master".
Counting objects: 12, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.21 KiB | 0 bytes/s, done.
Total 12 (delta 11), reused 0 (delta 0)
To ssh://......./diffusion/P/.......
   abe06dd..2573940  2573940a7301f0a4fadd1dda3e18ddb534a66eb0 -> master
 UPDATE  Local "master" tracks target remote "origin/master", checking out and pulling changes.
 PULL  Checking out and pulling "master".
Cleaning up branch "......."...
(Use `git checkout -b ....... 4a4256a31e1ce90b4b178a6bd54884fe8fb16ad6` if you want it back.)
 DONE  Landed changes.

On Windows, it's very often (almost always) that there'll be some sort of UI for Git running (whether it's Git Extensions, SourceTree or the Visual Studio Git plugin). When these UIs periodically run git status, they block arc land from working properly.

It would be better if arc land automatically retried (up to a limit) when index.lock exists so I don't have to run arc land 4 times to land my code.

Event Timeline

hach-que created this task.Jan 13 2016, 5:36 AM
avivey added a subscriber: avivey.Jan 14 2016, 2:29 AM

can this happen outside of Windows? Do *nix have some better flock features?

I'm pretty sure it can happen anywhere; I've definitely seen it happen on Linux, but my guess is that it's much more infrequent just because you're unlikely to have GUI tools periodically running "git status".

Just got this 3 times in a row again.

It'd be nice to have Arcanist retry or wait until index.lock is not present before attempting any Git operations.

You're currently the only user we're aware of who experiences this -- have you tried changing your IDE so it, e.g., only polls git while in the foreground?

In particular, the IDE's behavior must hurt you normally too? If you run raw git commands, you must occasionally hit these locks yourself?

I'm hesitant about working around problems in third-party software just because it's easier to change Phabricator than other tools. Taken to the extreme, this leaves us bearing the weight of everyone else's technical debt as punishment for being flexible and moving quickly.

hach-que added a comment.EditedJul 29 2016, 4:53 AM

Other users at my work experience this (i.e. about 40 or so developers run into this on a regular basis). It's an issue which is particularly bad on Windows. I think it's bad because process startup / shutdown is much more expensive on Windows than it is on Linux, which means "git status" runs for a lot longer.

We can't switch out IDEs; when you're writing C# code you basically have to use Visual Studio, and that polls Git status on a regular basis. It's the same with Visual Studio Code (which is the non-C# editor on Windows for a variety of different languages), which seems to poll even more often.

Other tools appear to be well behaved in this area; if index.lock exists when using Git browsers like Git Extensions, they just automatically retry once index.lock is gone.

epriestley closed this task as Wontfix.Nov 14 2016, 5:41 PM
epriestley claimed this task.

If you're using a closed-source IDE, you can change the IDE's behavior by working with the IDE's vendor.