git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: fatal: Unable to create '.../.git/index.lock': File exists.

From
AMAleksey Midenkov <midenok@gmail.com>
Date
May 2, 2019, 13:45 UTC
Message-ID
<CAF8BazAK_s89XY8-AAsSSbgOFgP03CLRZ50bLGPsc89bfnN7kQ@mail.gmail.com>
In-Reply-To
<20190501183638.GF4109@sigill.intra.peff.net>
On Wed, May 1, 2019 at 9:36 PM Jeff King <peff@peff.net> wrote:
Show 27 quoted lines
>
> On Wed, May 01, 2019 at 10:15:19AM +0300, Aleksey Midenkov wrote:
>
> > > Usually when we see racy contention on index.lock, the culprit turns out
> > > to be another unrelated git process refreshing the index. Do you have
> > > anything else running which might be using "git status" (e.g., magit in
> > > emacs, vim git integration, etc)?
> >
> > kdevelop which is git-aware. But if git fails on concurrent operation
> > this is still not good. I would expect it to wait until lock releases
> > for some time.
>
> Historically Git does not wait for locks because whoever is holding the
> lock is likely to invalidate the changes we're proposing to make by
> taking the lock in the first place. We've softened on that a bit in
> recent years (e.g., ref updates now retry with a timeout to accommodate
> things like reflog pruning), but I don't think the index code does.
>
> If the other entity holding the lock is just updating the stat
> information in the index, that's probably OK. If it's actually
> manipulating the index, I think we'd have to give more thought about
> whether that's safe.
>
> Assuming that kdevelop is just running "git status" in the background,
> though, there's an easier solution. If it uses "git --no-optional-locks
> status" instead, that will instruct it not to take the index lock at
> all.

And can we disable optional locks at git configuration level? Because changing source code of each application that is not aware of this option is not an easier solution.

>
> -Peff
-- 
All the best,

Aleksey Midenkov
@midenok
Previous: Jeff KingNext: Jeff King
Message 7 of 15 in “Bug: fatal: Unable to create '.../.git/index.lock': File exists.”
  1. Aleksey MidenkovApr 29, 2019
  2. Duy NguyenApr 29, 2019
  3. Aleksey MidenkovApr 30, 2019
  4. Jeff KingApr 30, 2019
  5. Aleksey MidenkovMay 1, 2019
  6. Jeff KingMay 1, 2019
  7. Aleksey MidenkovMay 2, 2019
  8. Jeff KingMay 2, 2019
  9. Duy NguyenMay 2, 2019
  10. Jeff KingMay 2, 2019
  11. Duy NguyenMay 2, 2019
  12. Johannes SchindelinMay 3, 2019
  13. Duy NguyenMay 3, 2019
  14. Duy NguyenMay 3, 2019
  15. Johannes SchindelinApr 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.