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

Re: push race

From
MBMarc Branchaud <mbranchaud@xiplink.com>
Date
Oct 15, 2012, 14:29 UTC
Message-ID
<507C1DB4.2010000@xiplink.com>
In-Reply-To
<CACBZZX5keWVDZ-rvQfHFChKRC1YwXcUvfiqzgeMjVTydnQCdmg@mail.gmail.com>
On 12-10-15 10:09 AM, Ævar Arnfjörð Bjarmason wrote:
Show 20 quoted lines
> On Mon, Oct 15, 2012 at 11:14 AM, Angelo Borsotti
> <angelo.borsotti@gmail.com> wrote:
>> Hello,
> 
> FWIW we have a lot of lemmings pushing to the same ref all the time at
> $work, and while I've seen cases where:
> 
>  1. Two clients try to push
>  2. They both get the initial lock
>  3. One of them fails to get the secondary lock (I think updating the ref)
> 
> I've never seen cases where they clobber each other in #3 (and I would
> have known from "dude, where's my commit that I just pushed" reports).
> 
> So while we could fix git to make sure there's no race condition such
> that two clients never get the #2 lock I haven't seen it cause actual
> data issues because of two clients getting the #3 lock.
> 
> It might still happen in some cases, I recommend testing it with e.g.
> lots of pushes in parallel with GNU Parallel.

Here's a previous discussion of a race in concurrent updates to the same ref, even when the updates are all identical:

http://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=164636
In that thread, Peff outlines the lock procedure for refs:
        1. get the lock
        2. check and remember the sha1
        3. release the lock
        4. do some long-running work (like the actual push)
        5. get the lock
        6. check that the sha1 is the same as the remembered one
        7. update the sha1
        8. release the lock

Angelo, in your case I think one of your concurrent updates would fail in step 6. As you say, this is after the changes have been uploaded. However, there's none of the file-overwriting that you fear, because the changes are stored in git's object database under their SHA hashes. So there'll only be an object-level collision if two parties upload the exact same object, in which case it doesn't matter.

		M.
Previous: demerphqNext: Angelo Borsotti
Message 6 of 20 in “push race”
  1. Angelo BorsottiOct 15, 2012
  2. Matthieu MoyOct 15, 2012
  3. Nguyen Thai Ngoc DuyOct 15, 2012
  4. Ævar Arnfjörð BjarmasonOct 15, 2012
  5. demerphqOct 15, 2012
  6. Marc BranchaudOct 15, 2012
  7. Angelo BorsottiOct 15, 2012
  8. Jeff KingOct 15, 2012
  9. Jeff KingOct 15, 2012
  10. Shawn PearceOct 16, 2012
  11. Jeff KingOct 16, 2012
  12. Nguyen Thai Ngoc DuyOct 16, 2012
  13. Jeff KingOct 16, 2012
  14. Nguyen Thai Ngoc DuyOct 16, 2012
  15. Jeff KingOct 16, 2012
  16. Junio C HamanoOct 16, 2012
  17. Jeff KingOct 16, 2012
  18. Junio C HamanoOct 16, 2012
  19. Angelo BorsottiOct 16, 2012
  20. Angelo BorsottiOct 15, 2012

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.