diff --git a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java index ea0239aae450d..7509dd86344d2 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java @@ -2264,7 +2264,13 @@ private void bumpPrimaryTerm(long newPrimaryTerm, final Ch onBlocked.run(); } }, - e -> failShard("exception during primary term transition", e)); + e -> { + try { + failShard("exception during primary term transition", e); + } catch (AlreadyClosedException ace) { + // ignore, shard is already closed + } + }); pendingPrimaryTerm = newPrimaryTerm; termUpdated.countDown(); }