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
Duy Nguyen <pclouds@gmail.com>
Date
May 3, 2019, 05:42 UTC
Message-ID
<CACsJy8AWfARPKczV7nGoBz35cBGsuNBtfh5pCFHvjBSB1_HHWg@mail.gmail.com>
In-Reply-To
<20190502165802.GA19341@sigill.intra.peff.net>
On Thu, May 2, 2019 at 11:58 PM Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> > I might take a stab at the "wait and try to hold the lock again, doing
> > necessary verification after if needed" idea. It sounds like the right
> > way to go and we haven't had problems with refs doing the same thing
> > (have we?).
>
> No, but it's a bit easier with refs because the locking is just
> atomically checking the lease. I.e., after taking the lock we still say
> "we expected the ref to be at oid XYZ, is it still there?". What's the
> equivalent for an index operation?

We could add a second hash that only covers the valuable parts (e.g. paths, stage index, SHA-1 and probably some ce_flags). This should be enough to verify if the index is still the same as before (stat info does not count, the same for other cache data like untracked cache, cache-tree...).

This will add some overhead of course because we hash more, especially on large index files. So it will be optional. The hash is stored in an extension. If you run things in parallel and want this, enable it. If the extension is not present in the first place, we don't attempt to wait and retry or anything.

-- 
Duy
Previous: Duy NguyenNext: Johannes Schindelin
Message 14 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.