Issue 2712: gerrit gc, file not found exception - git 2.0.0 related.
Status:  New
Owner: ----
Reported by Ian.Kuml...@gmail.com, Jun 12, 2014
************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

Affected Version:
2.8.5

What steps will reproduce the problem?
1. Use git 2.0.0
2. repack gits and wait
3. clone some gits - it's a race you might need to rise and repeat.

Output from git 2.0.0, repacking - it states that it reuses the bitmap:

git repack -adfb
Counting objects: 7582, done.
Delta compression using up to 24 threads.
Compressing objects: 100% (7477/7477), done.
Writing objects: 100% (7582/7582), done.
Reusing bitmaps: 98, done.
Selecting bitmap commits: 1742, done.
Building bitmaps: 100% (122/122), done.
Total 7582 (delta 5822), reused 1760 (delta 0)

gerrit/jgit does not detect this, so any git handled this way can fail.

Solution is to run jgit gc on the git outside gerrit.

What is the expected output? What do you see instead?
If a file is deemed missing, drop caches and try again... 

Please provide any additional information below.

[2014-06-12 10:42:38,120] ERROR com.google.gerrit.server.git.GarbageCollection : [tools/internal/community_mirror/git-repo]
org.eclipse.jgit.api.errors.JGitInternalException: Garbage collection failed.
	at org.eclipse.jgit.api.GarbageCollectCommand.call(GarbageCollectCommand.java:126)
	at com.google.gerrit.server.git.GarbageCollection.run(GarbageCollection.java:83)
	at com.google.gerrit.sshd.commands.GarbageCollectionCommand.runGC(GarbageCollectionCommand.java:97)
	at com.google.gerrit.sshd.commands.GarbageCollectionCommand.access$500(GarbageCollectionCommand.java:41)
	at com.google.gerrit.sshd.commands.GarbageCollectionCommand$1.run(GarbageCollectionCommand.java:67)
	at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:442)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
	at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:364)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.FileNotFoundException: <internal-path>/tools/internal/community_mirror/git-repo.git/objects/pack/pack-6f608c49f25fd1e497995f7d38733e196e129a82.bitmap (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:146)
	at org.eclipse.jgit.internal.storage.file.PackBitmapIndex.open(PackBitmapIndex.java:96)
	at org.eclipse.jgit.internal.storage.file.PackFile.getBitmapIndex(PackFile.java:1065)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.getBitmapIndex(WindowCursor.java:110)
	at org.eclipse.jgit.internal.storage.pack.PackWriterBitmapPreparer.<init>(PackWriterBitmapPreparer.java:107)
	at org.eclipse.jgit.internal.storage.pack.PackWriter.prepareBitmapIndex(PackWriter.java:2031)
	at org.eclipse.jgit.internal.storage.file.GC.writePack(GC.java:739)
	at org.eclipse.jgit.internal.storage.file.GC.repack(GC.java:547)
	at org.eclipse.jgit.internal.storage.file.GC.gc(GC.java:166)
	at org.eclipse.jgit.api.GarbageCollectCommand.call(GarbageCollectCommand.java:123)
	... 13 more