Recovery was canceled reason reason – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when the recovery process of an Elasticsearch shard is interrupted or stopped due to a specific reason. This could be due to a node leaving the cluster, a newer recovery process starting, or a manual cancellation. To resolve this issue, you can try to restart the recovery process, ensure the stability of your cluster to prevent nodes from leaving unexpectedly, or check for any manual interruptions that could be causing the cancellation.

This guide will help you check for common problems that cause the log ” recovery was canceled reason [” + reason + “] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: recovery, indices.

Log Context

Log “recovery was canceled reason [” + reason + “]” class name is RecoverySourceHandler.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 cancellableThreads.setOnCancel((reason; beforeCancelEx) -> {
 final RuntimeException e;
 if (shard.state() == IndexShardState.CLOSED) { // check if the shard got closed on us
 e = new IndexShardClosedException(shard.shardId(); "shard is closed and recovery was canceled reason [" + reason + "]");
 } else {
 e = new CancellableThreads.ExecutionCancelledException("recovery was canceled reason [" + reason + "]");
 }
 if (beforeCancelEx != null) {
 e.addSuppressed(beforeCancelEx);
 }
 IOUtils.closeWhileHandlingException(releaseResources; () -> future.onFailure(e));

 

 [ratemypost]