Remove old ref lock files during GarbageCollect RPC
After https://gitlab.com/gitlab-org/gitlab-ce/issues/40461#note_54686824
We see issues in production where some Git or libgit2 process takes a ref lock in a repository and never releases it. This probably means the process died without being able to release the lock.
When this happens the repository is left in a broken state; the locked ref can no longer be updated. This also breaks git gc
, i.e. the GarbageCollect RPC.
What I propose we do is at the start of the GarbageCollect we walk the refs
directory of the repository and we delete any *.lock
files we find that are older than 1 hour. We should also check for the existence of a packed-refs.lock
older than 1 hour in the root.
Stages:
RPC Endpoints:
RepositoryService::GarbageCollect
Known Client Routes:
- Known client endpoints
Edited by Jacob Vosmaer