Failed to stop due to error – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 8-8.2

Briefly, this error occurs when Elasticsearch encounters an issue while attempting to stop its services. This could be due to a variety of reasons such as insufficient permissions, a locked file, or a process that is still using resources. To resolve this issue, you can try to identify and stop the process that is still using resources, ensure that Elasticsearch has the necessary permissions to stop services, or check for any locked files that may be preventing the stop operation. If the problem persists, consider restarting the system or reinstalling Elasticsearch.

This guide will help you check for common problems that cause the log ” [{}] failed to stop due to error ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, allocation.

Log Context

Log “[{}] failed to stop due to error” classname is TrainedModelAllocationNodeService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

    public void stopDeploymentAndNotify(TrainedModelDeploymentTask task; String reason; ActionListener listener) {
        ActionListener notifyDeploymentOfStopped = ActionListener.wrap(
            _void -> updateStoredState(task.getModelId(); new RoutingStateAndReason(RoutingState.STOPPED; reason); listener);
            failed -> { // if we failed to stop the process; something strange is going on; but we should still notify of stop
                logger.warn(() -> new ParameterizedMessage("[{}] failed to stop due to error"; task.getModelId()); failed);
                updateStoredState(task.getModelId(); new RoutingStateAndReason(RoutingState.STOPPED; reason); listener);
            }
        );
        updateStoredState(
            task.getModelId();

 

 [ratemypost]