Skip to content

Commit

Permalink
Handle AlreadyClosedException when bumping primary term
Browse files Browse the repository at this point in the history
If the shard is already closed while bumping the primary term, this can result in an
AlreadyClosedException to be thrown. As we use asyncBlockOperations, the exception
will be thrown on a thread from the generic thread pool and end up in the uncaught
exception handler, failing our tests.

Relates to #32442
  • Loading branch information
ywelsch committed Aug 6, 2018
1 parent 3ef1e02 commit d3b5488
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,13 @@ private <E extends Exception> 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();
}
Expand Down

0 comments on commit d3b5488

Please sign in to comment.