Not all shards are closed yet waited 30sec – stopping service – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 1.5-1.5

Briefly, this error occurs when Elasticsearch is trying to stop a service but some shards are still open, even after waiting for 30 seconds. This could be due to heavy indexing or search operations that are still in progress. To resolve this issue, you can increase the timeout period to allow more time for the shards to close. Alternatively, you can manually close the shards before stopping the service. Also, ensure that your cluster is not overloaded with operations, as this can slow down the closing of shards.

This guide will help you check for common problems that cause the log ” Not all shards are closed yet; waited 30sec – stopping service ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: indices and shards.

Log Context

Log “Not all shards are closed yet; waited 30sec – stopping service” classname is IndicesService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

}
            });
        }
        try {
            if (latch.await(30; TimeUnit.SECONDS) == false) {
              logger.warn("Not all shards are closed yet; waited 30sec - stopping service");
            }
        } catch (InterruptedException e) {
            // ignore
        } finally {
            indicesStopExecutor.shutdown();

 

 [ratemypost]