1
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-05-09 17:08:15 +00:00
gitea/services
Royce Remer e0ad72e223
Fail mirroring more gracefully ()
* 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>
2025-03-26 18:04:46 +00:00
..
actions Added Description Field for Secrets and Variables () 2025-03-17 19:24:54 +00:00
agit Move git references checking to gitrepo packages to reduce expose of repository path () 2025-03-15 19:48:59 -07:00
asymkey Don't create duplicated functions for code repositories and wiki repositories () 2025-03-19 11:17:19 -07:00
attachment Include file extension checks in attachment API () 2024-11-06 21:34:32 +00:00
auth Fix some migration and repo name problems () 2025-03-24 20:26:58 -07:00
automerge Move git references checking to gitrepo packages to reduce expose of repository path () 2025-03-15 19:48:59 -07:00
context Git client will follow 301 but 307 () 2025-03-25 07:20:08 +00:00
contexttest Add file tree to file view page () 2025-03-15 16:26:49 +08:00
convert Decouple diff stats query from actual diffing () 2025-03-08 17:36:08 +08:00
cron Use default Git timeout when checking repo health () 2025-02-14 15:13:56 +00:00
doctor Fix some migration and repo name problems () 2025-03-24 20:26:58 -07:00
externalaccount allow synchronizing user status from OAuth2 login providers () 2024-07-16 20:33:16 +02:00
feed Only use prev and next buttons for pagination on user dashboard () 2025-03-23 19:52:43 +00:00
forms Added Description Field for Secrets and Variables () 2025-03-17 19:24:54 +00:00
git Move commits signature and verify functions to service layers () 2025-02-16 12:24:07 +00:00
gitdiff Try to figure out attribute checker problem () 2025-03-17 11:59:34 -07:00
indexer Update issue indexer after merging a PR () 2024-05-08 14:45:15 +00:00
issue Pull request updates will also trigger code owners review requests () 2025-03-13 19:36:14 -07:00
lfs Fix SSH LFS memory usage () 2025-01-31 19:05:48 +08:00
mailer remove context from mail struct () 2025-03-06 20:57:00 +00:00
markup Use test context in tests and new loop system in benchmarks () 2025-02-20 09:57:40 +00:00
migrations Fix some migration and repo name problems () 2025-03-24 20:26:58 -07:00
mirror Fail mirroring more gracefully () 2025-03-26 18:04:46 +00:00
notify Add workflow_job webhook () 2025-03-11 10:40:38 -07:00
oauth2_provider Introduce OrgList and add LoadTeams, optimaze Load teams for orgs () 2024-11-26 21:55:06 +00:00
org Decouple context from repository related structs () 2025-03-08 13:12:46 -08:00
packages Decouple context from repository related structs () 2025-03-08 13:12:46 -08:00
projects Fix project issues list and counting () 2025-02-17 05:14:56 +00:00
pull Move git references checking to gitrepo packages to reduce expose of repository path () 2025-03-15 19:48:59 -07:00
release Move git references checking to gitrepo packages to reduce expose of repository path () 2025-03-15 19:48:59 -07:00
repository Fix some migration and repo name problems () 2025-03-24 20:26:58 -07:00
secrets Added Description Field for Secrets and Variables () 2025-03-17 19:24:54 +00:00
task Fix "force private" logic () 2024-05-20 00:56:45 +00:00
uinotification Penultimate round of db.DefaultContext refactor () 2023-10-11 04:24:07 +00:00
user Refactor repository transfer () 2025-01-30 05:40:44 +00:00
versioned_migration Add global lock for migrations to make upgrade more safe with multiple replications () 2025-03-07 21:08:53 +00:00
webhook Refactor functions to reduce repopath expose () 2025-03-16 03:14:56 +00:00
webtheme Improve theme display () 2025-03-08 21:38:11 +00:00
wiki Don't create duplicated functions for code repositories and wiki repositories () 2025-03-19 11:17:19 -07:00