From 1bf57848252863f30af3eed9b4aecdb4ce4b0635 Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Tue, 12 Jul 2016 11:40:36 -0400 Subject: [PATCH] Mergeability: handle UncheckedExecutionException like ExecutionException Before this fix, UncheckedExecution exceptions caused by IllegalState exceptions like "Duplicate stages not allowed" from jgit DirCacheBuilder used to fail re-indexing. The stack trace available from the below linked Issue is our recently noticed example of this. This fix treats such exceptions the same way as Execution exceptions are currently handled in MergeabilityCacheImpl. Should an UncheckedExecutionException be thrown within checking mergeability from re-indexing (or other threads), then the mergeability flag gets set to false -as for a checked ExecutionException. Bug: Issue 4249 Change-Id: I270db012c2796a7bebeb66ffe2969d7564daebe0 --- .../com/google/gerrit/server/change/MergeabilityCacheImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java index 826ebdd438..0f55e587c5 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java @@ -28,6 +28,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; +import com.google.common.util.concurrent.UncheckedExecutionException; import com.google.gerrit.extensions.client.SubmitType; import com.google.gerrit.reviewdb.client.Branch; import com.google.gerrit.reviewdb.server.ReviewDb; @@ -269,7 +270,7 @@ public class MergeabilityCacheImpl implements MergeabilityCache { EntryKey key = new EntryKey(commit, into, submitType, mergeStrategy); try { return cache.get(key, new Loader(key, dest, repo, db)); - } catch (ExecutionException e) { + } catch (ExecutionException | UncheckedExecutionException e) { log.error(String.format("Error checking mergeability of %s into %s (%s)", key.commit.name(), key.into.name(), key.submitType.name()), e.getCause());