This creates an issue for data gathering in https://wikimedia.biterg.io in T157898#3124564.
Way to reproduce:
gerrit query --patch-sets 99101
Abstract stacktrace suggests the change cache has troubles:
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.ArrayIndexOutOfBoundsException: 0 at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2207) at com.google.common.cache.LocalCache.get(LocalCache.java:3953) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4790) at com.google.gerrit.server.cache.h2.H2CacheImpl.get(H2CacheImpl.java:139) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKind(ChangeKindCacheImpl.java:329)
Stack trace from above CLI command
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.ArrayIndexOutOfBoundsException: 0 at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2207) at com.google.common.cache.LocalCache.get(LocalCache.java:3953) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4790) at com.google.gerrit.server.cache.h2.H2CacheImpl.get(H2CacheImpl.java:139) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKind(ChangeKindCacheImpl.java:329) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKindInternal(ChangeKindCacheImpl.java:378) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKindInternal(ChangeKindCacheImpl.java:405) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKind(ChangeKindCacheImpl.java:339) at com.google.gerrit.server.events.EventFactory.asPatchSetAttribute(EventFactory.java:508) at com.google.gerrit.server.events.EventFactory.addPatchSets(EventFactory.java:390) at com.google.gerrit.server.query.change.OutputStreamQuery.buildChangeAttribute(OutputStreamQuery.java:279) at com.google.gerrit.server.query.change.OutputStreamQuery.query(OutputStreamQuery.java:203) at com.google.gerrit.sshd.commands.Query.run(Query.java:96) at com.google.gerrit.sshd.SshCommand$1.run(SshCommand.java:35) 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:417) 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.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.jgit.revwalk.RevCommit.getParent(RevCommit.java:353) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.sameFirstParents(ChangeKindCacheImpl.java:261) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.onlyFirstParentChanged(ChangeKindCacheImpl.java:254) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.call(ChangeKindCacheImpl.java:225) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.call(ChangeKindCacheImpl.java:192) at com.google.gerrit.server.cache.h2.H2CacheImpl$LoadingCallable.call(H2CacheImpl.java:283) at com.google.gerrit.server.cache.h2.H2CacheImpl$LoadingCallable.call(H2CacheImpl.java:265) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4793) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3542) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2323) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2286) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201) ... 22 more
Stack trace reaching https://gerrit.wikimedia.org/r/#/c/99101
[2017-03-23 12:36:57,673] ERROR com.google.gerrit.httpd.restapi.RestApiServlet : Error in GET /r/changes/99101/detail?O=10004 com.google.common.util.concurrent.UncheckedExecutionException: java.lang.ArrayIndexOutOfBoundsException: 0 at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2207) at com.google.common.cache.LocalCache.get(LocalCache.java:3953) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4790) at com.google.gerrit.server.cache.h2.H2CacheImpl.get(H2CacheImpl.java:139) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKind(ChangeKindCacheImpl.java:329) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKindInternal(ChangeKindCacheImpl.java:378) at com.google.gerrit.server.change.ChangeKindCacheImpl.getChangeKind(ChangeKindCacheImpl.java:346) at com.google.gerrit.server.change.ChangeJson.toRevisionInfo(ChangeJson.java:1000) at com.google.gerrit.server.change.ChangeJson.revisions(ChangeJson.java:939) at com.google.gerrit.server.change.ChangeJson.toChangeInfo(ChangeJson.java:499) at com.google.gerrit.server.change.ChangeJson.format(ChangeJson.java:262) at com.google.gerrit.server.change.ChangeJson.format(ChangeJson.java:253) at com.google.gerrit.server.change.ChangeJson.format(ChangeJson.java:231) at com.google.gerrit.server.change.GetChange.apply(GetChange.java:50) at com.google.gerrit.server.change.GetDetail.apply(GetDetail.java:51) at com.google.gerrit.server.change.GetDetail.apply(GetDetail.java:26) at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) at com.google.gerrit.httpd.GetUserFilter.doFilter(GetUserFilter.java:82) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RequireSslFilter.doFilter(RequireSslFilter.java:77) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:73) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:122) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RequestMetricsFilter.doFilter(RequestMetricsFilter.java:60) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:136) at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:138) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:75) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.jgit.revwalk.RevCommit.getParent(RevCommit.java:353) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.sameFirstParents(ChangeKindCacheImpl.java:261) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.onlyFirstParentChanged(ChangeKindCacheImpl.java:254) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.call(ChangeKindCacheImpl.java:225) at com.google.gerrit.server.change.ChangeKindCacheImpl$Loader.call(ChangeKindCacheImpl.java:192) at com.google.gerrit.server.cache.h2.H2CacheImpl$LoadingCallable.call(H2CacheImpl.java:283) at com.google.gerrit.server.cache.h2.H2CacheImpl$LoadingCallable.call(H2CacheImpl.java:265) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4793) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3542) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2323) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2286) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201) ... 55 more