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

Avoid race condition between fetch and repack/gc?

From
Andreas Krey <a.krey@gmx.de>
Date
Mar 16, 2020, 08:23 UTC
Message-ID
<20200316082348.GA26581@inner.h.apk.li>
Hi all,
we occasionally seeing things like this:
| DEBUG: 11:25:20: git -c advice.fetchShowForcedUpdates=false fetch --no-show-forced-updates -q --prune
| Warning: Permanently added '[socgit.$company.com]:7999' (RSA) to the list of known hosts.
| remote: fatal: packfile ./objects/pack/pack-20256f2be3bd51b57e519a9f2a4d3df09f231952.pack cannot be accessed        
| error: git upload-pack: git-pack-objects died with error.
| fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
| remote: aborting due to possible repository corruption on the remote side.
| fatal: protocol error: bad pack header

and when you look in the server repository there is a new packfile dated just around that time. It looks like the fetch tries to access a packfile that it assumes to exist, but the GC on the server throws it away just in that moment, and thus upload-pack fails.

Is there a way to avoid this?
Should there be, like git repack waiting a bit before deleting old packfiles?
- Andreas
-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Next: Derrick Stolee
Message 1 of 6 in “Avoid race condition between fetch and repack/gc?”
  1. Andreas KreyMar 16, 2020
  2. Derrick StoleeMar 16, 2020
  3. Nasser GrainawiMar 16, 2020
  4. Jeff KingMar 16, 2020
  5. Bryan TurnerMar 16, 2020
  6. Jeff KingMar 17, 2020

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.