Application fails to start with FileLockedExternallyException - Cannot lock file in exclusive mode - already in use
Symptoms
Fisheye/Crucible cannot be started and the following error is visible in the logs:
2010-01-29 13:18:46,598 INFO [main] fisheye.app InfinityDbHandle-open - opening /path/to/fisheye_inst/var/data/data0.bin with cachesize=2500000
2010-01-29 13:18:46,613 INFO [main] fisheye.app Run-mainImpl - DBE com.cenqua.fisheye.rep.DbException: com.cenqua.obfuscate.idbktbulx.locking.FileLockedExternallyException: Cannot lock file in exclusive mode - already in use
at com.cenqua.fisheye.config.RootConfig.startDB(RootConfig.java:1050)
at com.cenqua.fisheye.config.RootConfig.start(RootConfig.java:359)
at com.cenqua.fisheye.ctl.Run.mainImpl(Run.java:169)
at com.cenqua.fisheye.ctl.Run.main(Run.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Caused by: com.cenqua.obfuscate.idbktbulx.locking.FileLockedExternallyException: Cannot lock file in exclusive mode - already in use
at com.cenqua.obfuscate.idbktbulx.locking.ChannelLock.<init>(InfinityDB_1.0.53:110)
at com.cenqua.obfuscate.idbktbulx._ktbulxIDB.open(InfinityDB_1.0.53:707)
at com.cenqua.obfuscate.idbktbulx._ktbulxIDB.open(InfinityDB_1.0.53:600)
at com.cenqua.fisheye.infinitydb.InfinityDbHandle.open(InfinityDbHandle.java:55)
Cause
FISHEYE_INST
by placing a FISHEYE_INST/var/fisheye.lck
file. This "lock" is placed when:- There is a running Fisheye/Crucible instance and there is an attempt to start a new one on the same
FISHEYE_INST
. - An "abnormal" shutdown has corrupted the instance and caused the
data.bin
files to be locked.
Resolution
Check that there is no second instance of Fisheye/Crucible running and that no other process has the files open. To see if any of the files are currently open, the following command can be used (on a Unix system):
[amyers@erdinger:~]$ lsof | grep data.*bin
java 24046 amyers 11u REG 14,2 7624 18559995 /Users/amyers/Applications/fisheye/fecru-2.1.3/var/data/data0.bin
java 24046 amyers 26u REG 14,2 822752 18785409 /Users/amyers/Applications/fisheye/fecru-2.1.3/var/cache/CVS/revcache/data.bin
java 24046 amyers 27u REG 14,2 11480 19301135 /Users/amyers/Applications/fisheye/fecru-2.1.3/var/cache/Git/revcache/data.bin
java 24046 amyers 28u REG 14,2 11496 19443395 /Users/amyers/Applications/fisheye/fecru-2.1.3/var/cache/Git2/revcache/data.bin
If there are any other processes accessing these files, these will need to be stopped (e.g. restart the system) in order to clear them.
Checking the file system is also a suggested practice. NFS or other network based file systems will have their own unlocking recipes.
In-place copy has been reported to work as well. From the FISHEYE_INST
directory a script containing the following actions can be executed with the right privileges over each repository's var/cache
:
cp data.bin data.bin.cp
rm data.bin
mv data.bin.cp data.bin
And for the var/data
:
cp data0.bin data0.bin.cp
rm data0.bin
mv data0.bin.cp data0.bin