I have experienced a very strange behaviour when triggering a Gerrit GC via SSHD.
The overall result is the inability to finalise a GC cycle on a very large repo (taking over 30 mins) because of the PackWriter threads terminated as a consequence of the SSHD channel timing out and then cancelling the associated threads.
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:103)
at com.google.gerrit.sshd.commands.GarbageCollectionCommand.access$500(GarbageCollectionCommand.java:44)
at com.google.gerrit.sshd.commands.GarbageCollectionCommand$1.run(GarbageCollectionCommand.java:73)
at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:442)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:364)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Packing cancelled during objects writing
at org.eclipse.jgit.internal.storage.pack.PackWriter.runTasks(PackWriter.java:1458)
at org.eclipse.jgit.internal.storage.pack.PackWriter.parallelDeltaSearch(PackWriter.java:1381)
at org.eclipse.jgit.internal.storage.pack.PackWriter.searchForDeltas(PackWriter.java:1333)
at org.eclipse.jgit.internal.storage.pack.PackWriter.searchForDeltas(PackWriter.java:1291)
at org.eclipse.jgit.internal.storage.pack.PackWriter.writePack(PackWriter.java:1018)
at org.eclipse.jgit.internal.storage.file.GC.writePack(GC.java:721)
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
I cannot really increase further the SSHD idle timeout (as otherwise I would impact Git/SSH users idle sessions) but at the same time I want to make sure that GC is getting completed.
- Generate some output on the SSH channel that is controlling the Gerrit GC (possibly with --show-progress)
Does it make sense to introduce a background mode for the gerrit gc command? GC is meant to be used by a crontab user and generates his output on the gc_log, having it in foreground on the SSHD channel really does not make so much sense to me :-)
Feedback is more than welcome as usual.
Luca.