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

Re: Git push race condition?

From
Nasser Grainawi <nasser@codeaurora.org>
Date
Mar 24, 2014, 22:59 UTC
Message-ID
<557DE2F7-1024-42A5-8192-ACE910CE6C81@codeaurora.org>
In-Reply-To
<20140324225434.GB17080@sigill.intra.peff.net>
On Mar 24, 2014, at 4:54 PM, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
> On Mon, Mar 24, 2014 at 03:18:14PM -0400, Scott Sandler wrote:
> 
>> I've noticed that a few times in the past several weeks, we've had
>> events where pushes have been lost when two people pushed at just
>> about the same time. The scenario is that two users both have commits
>> based on commit A, call them B and B'. The user with commit B pushes
>> at about the same time as the user who pushes B'. Both pushes are
>> determined to be fast-forwards and both succeed, but B' overwrites B
>> and B is no longer on origin/master. The server does have B in its
>> .git directory but the commit isn't on any branch.
> 
> What version of git are you running on the server? Is it possible that
> there is a simultaneous process running `git pack-refs` (e.g., a `git
> gc` run by a cron job or similar)?

`git gc --auto` could be getting triggered as well, so if you suspect that you could set gc.auto=0 on the server side.

Show 11 quoted lines
> 
> There were some race conditions fixed last year wherein git could see
> stale values of refs, but I do not think they could impact writing to a
> ref like this.  When we take the lock on the ref, we always go straight
> to the filesystem, so the value we see is up-to-date.
> 
> -Peff
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora 
Forum, hosted by The Linux Foundation
Previous: Jeff KingNext: Scott Sandler
Message 10 of 17 in “Git push race condition?”
  1. Scott SandlerMar 24, 2014
  2. Matthieu MoyMar 24, 2014
  3. Scott SandlerMar 24, 2014
  4. Matthieu MoyMar 24, 2014
  5. Junio C HamanoMar 24, 2014
  6. Ævar Arnfjörð BjarmasonMar 24, 2014
  7. Scott SandlerMar 24, 2014
  8. Jeff KingMar 24, 2014
  9. Jeff KingMar 24, 2014
  10. Nasser GrainawiMar 24, 2014
  11. Scott SandlerMar 25, 2014
  12. Matthieu MoyMar 25, 2014
  13. Scott SandlerMar 25, 2014
  14. Matthieu MoyMar 25, 2014
  15. Jeff KingMar 25, 2014
  16. Scott SandlerApr 10, 2014
  17. Matthieu MoyApr 11, 2014

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.