Bug #2073
Git locks may be left after crash and prevent update operation on z2 sync or startup
Start date:
17.06.2020
Due date:
% Done:
0%
Estimated time:
origin:
Description
Z2 uses JGit as Git client. JGit however (for compatibility reasons (?)) uses a file-based locking mechanism that does not make sure that locks of a process will be released upon termination of the process.
In crash situations that may lead to situations where z2, if using the git cr, cannot start up again.
Instead, exceptions like this will be thrown:
Caused by: org.eclipse.jgit.errors.LockFailedException: Cannot lock <...>/git/.git/index. Ensure that no other process has an open file handle on the lock file <...>/git/.git/index.lock, then you may delete the lock file and retry.
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:251)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:328)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:294)
at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:1205)
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:266)
... 45 more
Acceptance Criteria¶
- There is a safe process-owned file lock before accessing the repo storage using the Git client
- Before accessing, all *.lock files are found and removed from
- ".git"
- ".git/refs/heads"
References¶
Background¶
Checking the JGit code base shows there is "index.lock" at .git and there is locking per ref.
Related issues