diff options
author | Royce Remer <royceremer@gmail.com> | 2025-03-26 11:04:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-26 18:04:46 +0000 |
commit | e0ad72e2233f885669c26d9063a91abd594fb9f6 (patch) | |
tree | 5995b04eb0de2fb6b5ea1596b5f1fd825938be6f /routers/web/repo/webhook.go | |
parent | c7b85f7070b4bebb34327e99a6940b68bf202163 (diff) | |
download | gitea-e0ad72e2233f885669c26d9063a91abd594fb9f6.tar.gz gitea-e0ad72e2233f885669c26d9063a91abd594fb9f6.zip |
Fail mirroring more gracefully (#34002)
* reuse recoverable error checks across mirror_pull
* add new cases for 'cannot lock ref/not our ref' (race condition in
fetch) and 'Unable to create/lock"
* move lfs sync right after commit graph write, and before other
maintenance which may fail
* try a prune for 'broken reference' as well as 'not our ref'
* always sync LFS right after commit graph write, and before other
maintenance which may fail
This handles a few cases where our very large and very active
repositories could serve mirrored git refs, but be missing lfs files:
## Case 1 (multiple variants): Race condition in git fetch
There was already a check for 'unable to resolve reference' on a failed
git fetch, after which a git prune and then subsequent fetch are
performed. This is to work around a race condition where the git remote
tells Gitea about a ref for some HEAD of a branch, then fails a few
seconds later because the remote branch was deleted, or the ref was
updated (force push).
There are two more variants to the error message you can get, but for
the same kind of race condition. These *may* be related to the git
binary version Gitea has access to (in my case, it was 2.48.1).
## Case 2: githttp.go can serve updated git refs before it's synced lfs
oids
There is probably a more aggressive refactor we could do here to have
the cat-file loop use FETCH_HEAD instead of relying on the commit graphs
to be committed locally (and thus serveable to clients of Gitea), but a
simple reduction in the occurrences of this for me was to move the lfs
sync block immediately after the commit-graph write and before any other
time-consuming (or potentially erroring/exiting) blocks.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/web/repo/webhook.go')
0 files changed, 0 insertions, 0 deletions