Cannot lock due to index.lock not removed after crash [message #1823307] |
Tue, 24 March 2020 12:46  |
Eclipse User |
|
|
|
Hi,
this happens on Ubuntu 18.04, Java 8, JGit 5.6.1.
Our application frequently needs to fetch updates from a remote repository to a local repository. This is part of a "self-updating" feature. Anyway, this also happens on nodes that perform background work. Sometimes these nodes fail and unfortunately sometimes they fail while fetching updates.
After that, the fetch fails with
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Cannot lock /repos/baseRepository/git/.git/index. Ensure that no other process has an open file handle on the lock file /repos/baseRepository/git/.git/index.lock, then you may delete the lock file and retry.
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:340)
at com.zfabrik.impl.gitcr.helper.GitTools.checkOutRef(GitTools.java:110)
... 10 more
Caused by: org.eclipse.jgit.errors.LockFailedException: Cannot lock /repos/baseRepository/git/.git/index. Ensure that no other process has an open file handle on the lock file /repos/baseRepository/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:322)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:288)
at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:1292)
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:270)
... 11 more
and it always takes a while for us to detect that failure. We would really like to avoid this problem in the first place.
I suppose there is a reason JGit does not use java.nio.channels.FileLock. It would be possible for our application however to make sure there is no concurrent access to the repository.
Is there a way to make sure JGit does not lock or use a safe locking implementation?
Thanks,
Henning
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03911 seconds