Project

General

Profile

Bug #2073

Updated by Henning Blohm over 4 years ago

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: 

 <pre><code> 
 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 
 </code></pre> 

 h2. 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" 

 h2. References Context 

 * https://www.eclipse.org/forums/index.php?t=msg&th=1102984&goto=1823307&#msg_1823307 

 h2. Background 

 Checking the JGit code base shows there is "index.lock" at .git and there is locking per ref.

Back