Lets me step back and start over so you can understand how I ended up looking into that commit.
We upgraded
from Gerrit 2.9.4 to 2.10 (which upgraded JGit from 3.4.2 to 3.6.2) and the users reported the 2 following issues:
-I cannot see my project: we fixed this one by restarting Gerrit (we had to, flush-cahes did not help),see stacktrace [1]
-I cannot push: we fixed some by running git repack and others were fixed when we had to restart for the previous issue, see stactraces [2] and [3].
During the upgrade, we also had an issue, the online reindexed failed(see stack trace [4] and [5]), we disabled our garbage collection and restarted Gerrit, the online reindexer completed successfully this time.
The only thing we changed during the upgrade is Gerrit, we have the same setup; storage, GC cron, Git version use by GC cron. Looking at the logs, every time there is an issue, there is a stacktrace about a missing commit following a stacktrace about an IOException accessing the pack file which lead me (maybe wrongfully) to think that
https://git.eclipse.org/r/#/c/39685 could have caused the problems since it changed the way it handles IOException.
Those issues were only reported on our busiest repositories, which happen to be GC more frequently than others (every 2 hours). The current situation is that we reduced the frequecy we run gc(to once a day in during the non-working hours) and we do not see the issues anymore.
In the repositories where we had issue, we configured the core.trustfolderstat option and it look like we no longer have the IOException "Stale file hande" but we have the FileNotFoundException which should be fixed by
https://git.eclipse.org/r/#/c/40503/. Should this change be in JGit 3.6, its only in 3.7 for now.
Hugo
[1]
[2015-03-23 07:38:07,749] WARN
com.google.gerrit.server.project.ProjectCacheImpl : Cannot read project <project_name>
java.util.concurrent.ExecutionException:
org.eclipse.jgit.errors.MissingObjectException: Missing unknown
67b30f728830954ff823df1ea5fe69e81a04d7cd
at
com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
at
com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
at
com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at
com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:135)
at
com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2346)
at
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2318)
at
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at
com.google.gerrit.server.project.ProjectCacheImpl.checkedGet(ProjectCacheImpl.java:142)
at
com.google.gerrit.server.project.ProjectCacheImpl.get(ProjectCacheImpl.java:129)
at
com.google.gerrit.server.project.ListProjects.display(ListProjects.java:266)
at
com.google.gerrit.sshd.commands.ListProjectsCommand$1.run(ListProjectsCommand.java:49)
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:368)
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: org.eclipse.jgit.errors.MissingObjectException: Missing
unknown 67b30f728830954ff823df1ea5fe69e81a04d7cd
at
org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:148)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:840)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:753)
at
com.google.gerrit.server.git.VersionedMetaData.load(VersionedMetaData.java:117)
at
com.google.gerrit.server.git.VersionedMetaData.load(VersionedMetaData.java:94)
at
com.google.gerrit.server.project.ProjectCacheImpl$Loader.load(ProjectCacheImpl.java:294)
at
com.google.gerrit.server.project.ProjectCacheImpl$Loader.load(ProjectCacheImpl.java:278)
at
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
... 18 more
[2]
ERROR: Exception caught while accessing pack file <path>/<project_name>.git/objects/pack/pack-863def7a513379ce9d1ef8ce024df62743f69100.pack, the pack file might be corrupt
java.io.IOException: Stale file handle
at java.io.RandomAccessFile.readBytes0(Native Method)
at java.io.RandomAccessFile.readBytes(RandomAccessFile.java:350)
at java.io.RandomAccessFile.read(RandomAccessFile.java:385)
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:444)
at org.eclipse.jgit.internal.storage.file.PackFile.read(PackFile.java:645)
at org.eclipse.jgit.internal.storage.file.WindowCache.load(WindowCache.java:289)
at org.eclipse.jgit.internal.storage.file.WindowCache.getOrLoad(WindowCache.java:368)
at org.eclipse.jgit.internal.storage.file.WindowCache.get(WindowCache.java:179)
at org.eclipse.jgit.internal.storage.file.WindowCursor.pin(WindowCursor.java:354)
at org.eclipse.jgit.internal.storage.file.WindowCursor.copy(WindowCursor.java:226)
at org.eclipse.jgit.internal.storage.file.PackFile.readFully(PackFile.java:556)
at org.eclipse.jgit.internal.storage.file.PackFile.load(PackFile.java:714)
at org.eclipse.jgit.internal.storage.file.PackFile.get(PackFile.java:257)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedObject(ObjectDirectory.java:414)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:383)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:375)
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:145)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:840)
at org.eclipse.jgit.transport.BaseReceivePack.checkConnectivity(BaseReceivePack.java:1110)
at org.eclipse.jgit.transport.BaseReceivePack.receivePackAndCheckConnectivity(BaseReceivePack.java:884)
at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:192)
at org.eclipse.jgit.transport.ReceivePack.receive(ReceivePack.java:161)
at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:115)
at com.google.gerrit.sshd.AbstractGitCommand.service(AbstractGitCommand.java:101)
at com.google.gerrit.sshd.AbstractGitCommand.access$000(AbstractGitCommand.java:32)
at com.google.gerrit.sshd.AbstractGitCommand$1.run(AbstractGitCommand.java:70)
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:368)
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)
[3]
[2015-03-21 11:36:23,273] ERROR com.google.gerrit.sshd.BaseCommand : Internal server error (user <user> account 1019628) during git-receive-pack '<project_name>.git'
com.google.gerrit.sshd.BaseCommand$Failure: fatal: Unpack error, check server log
at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:176)
at com.google.gerrit.sshd.AbstractGitCommand.service(AbstractGitCommand.java:101)
at com.google.gerrit.sshd.AbstractGitCommand.access$000(AbstractGitCommand.java:32)
at com.google.gerrit.sshd.AbstractGitCommand$1.run(AbstractGitCommand.java:70)
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:368)
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.IOException: Unpack error on project "<project_name>":
AdvertiseRefsHook: org.eclipse.jgit.transport.AdvertiseRefsHookChain@403e65c3class org.eclipse.jgit.transport.AdvertiseRefsHookChain
at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:175)
... 12 more
Caused by: org.eclipse.jgit.errors.UnpackException: Exception while parsing pack stream
at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:246)
at org.eclipse.jgit.transport.ReceivePack.receive(ReceivePack.java:161)
at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:115)
... 12 more
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 36ee45e2d3d2e3b25e8fb0789beb10c2babce519
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:148)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:840)
at org.eclipse.jgit.transport.BaseReceivePack.checkConnectivity(BaseReceivePack.java:1110)
at org.eclipse.jgit.transport.BaseReceivePack.receivePackAndCheckConnectivity(BaseReceivePack.java:884)
at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:192)
... 14 more
[4]
ERROR: Exception caught while accessing pack file
/<path><project_name>.git/objects/pack/pack-27ae30fb4364740fb7878b5253af33215134d2cf.pack,
the pack file might be corrupt
java.io.IOException: Stale file handle
at java.io.RandomAccessFile.readBytes0(Native Method)
at java.io.RandomAccessFile.readBytes(RandomAccessFile.java:350)
at java.io.RandomAccessFile.read(RandomAccessFile.java:385)
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:444)
at org.eclipse.jgit.internal.storage.file.PackFile.read(PackFile.java:645)
at org.eclipse.jgit.internal.storage.file.WindowCache.load(WindowCache.java:289)
at org.eclipse.jgit.internal.storage.file.WindowCache.getOrLoad(WindowCache.java:368)
at org.eclipse.jgit.internal.storage.file.WindowCache.get(WindowCache.java:179)
at org.eclipse.jgit.internal.storage.file.WindowCursor.pin(WindowCursor.java:354)
at org.eclipse.jgit.internal.storage.file.WindowCursor.copy(WindowCursor.java:226)
at org.eclipse.jgit.internal.storage.file.PackFile.readFully(PackFile.java:556)
at org.eclipse.jgit.internal.storage.file.PackFile.load(PackFile.java:714)
at org.eclipse.jgit.internal.storage.file.PackFile.get(PackFile.java:257)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedObject(ObjectDirectory.java:414)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:383)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:375)
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:145)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:840)
at com.google.gerrit.server.index.ChangeBatchIndexer$ProjectIndexer.call(ChangeBatchIndexer.java:295)
at com.google.gerrit.server.index.ChangeBatchIndexer$3.call(ChangeBatchIndexer.java:242)
at com.google.gerrit.server.index.ChangeBatchIndexer$3.call(ChangeBatchIndexer.java:226)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58)
at com.google.gerrit.server.index.ChangeBatchIndexer.indexAll(ChangeBatchIndexer.java:156)
at com.google.gerrit.lucene.OnlineReindexer.reindex(OnlineReindexer.java:79)
at com.google.gerrit.lucene.OnlineReindexer.access$000(OnlineReindexer.java:33)
at com.google.gerrit.lucene.OnlineReindexer$1.run(OnlineReindexer.java:62)
[5]
[2015-03-21 06:09:57,773] ERROR com.google.gerrit.server.index.ChangeBatchIndexer : Failed to index project<project_name>
java.util.concurrent.ExecutionException:
org.eclipse.jgit.errors.MissingObjectException: Missing unknown
9aae3b3c6e95d8ec29b000097e930533cdfc7487
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.google.gerrit.server.index.ChangeBatchIndexer$1.run(ChangeBatchIndexer.java:164)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)
at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:101)
at com.google.common.util.concurrent.ListenableFutureTask.addListener(ListenableFutureTask.java:83)
at com.google.gerrit.server.index.ChangeBatchIndexer.indexAll(ChangeBatchIndexer.java:160)
at com.google.gerrit.lucene.OnlineReindexer.reindex(OnlineReindexer.java:79)
at com.google.gerrit.lucene.OnlineReindexer.access$000(OnlineReindexer.java:33)
at com.google.gerrit.lucene.OnlineReindexer$1.run(OnlineReindexer.java:62)
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 9aae3b3c6e95d8ec29b000097e930533cdfc7487
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:148)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:840)
at com.google.gerrit.server.index.ChangeBatchIndexer$ProjectIndexer.call(ChangeBatchIndexer.java:295)
at com.google.gerrit.server.index.ChangeBatchIndexer$3.call(ChangeBatchIndexer.java:242)
at com.google.gerrit.server.index.ChangeBatchIndexer$3.call(ChangeBatchIndexer.java:226)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58)
at com.google.gerrit.server.index.ChangeBatchIndexer.indexAll(ChangeBatchIndexer.java:156)
... 3 more