Before you begin reading this guide, we recommend you run Elasticsearch Error Check-Up which can resolve issues that cause many errors.
This guide will help you check for common problems that cause the log ” Lock assertion failed ” to appear. It’s important to understand the issues related to the log, so to get started, read the general overview on common issues and tips related to the Elasticsearch concepts: node.
Advanced users might want to skip right to the common problems section in each concept or try running the Check-Up which analyses ES to pinpoint the cause of many errors and provides suitable actionable recommendations how to resolve them (free tool that requires no installation).
Overview:
Elasticsearch stores its data (shards, cluster state, etc.) on the file system and uses the path.data (config) to determine its data store location. There can be more than one Elaticsearch installation on the same node (host), and this error is thrown at startup time as part of the bootstrap checks to make sure there is no data corruption.
Potential causes for this error:
- Multiple Elasticsearch installations using the same data location.
- The node.max_local_storage_nodes setting is not set properly in the case of multiple Elasticsearch installations using the same location.
- An existing orphaned Elasticsearch process is already running, which uses the same location, and you are trying to start the new process.
- Elasticsearch doesn’t have write access to the data folder.
Exception message:
maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])
Troubleshooting steps:
- If you do not have multiple installations on the same machine, check if there is already an Elasticsearch process running by using ps aux | grep elastic, on *nix based system, and kill the process if it is not needed.
- To allow for more than one node (e.g., on your development machine, not recommended in production), use the setting node.max_local_storage_nodes and set this to a positive integer according to your requirement. Find more info in this official doc.
- Ensure the Elasticsearch process has write permission for the path.data location.
Disclaimer:
node.max_local_storage_nodes setting is deprecated in 7.x and will be removed in version 8.0.
Overview
Simply put a node is a single server that is part of a cluster. Each node is assigned one or more roles, which describe the node’s responsibility and operations – Data nodes stores the data, and participates in the cluster’s indexing and search capabilities, while master nodes are responsible for managing the cluster’s activities and storing the cluster state, including the metadata.
While it is possible to run several node instances of Elasticsearch on the same hardware, it’s considered a best practice to limit a server to a single running instance of Elasticsearch.
Nodes connect to each other and form a cluster by using a discovery method.
Roles
Master node
Master nodes are in charge of cluster-wide settings and changes – deleting or creating indices and fields, adding or removing nodes and allocating shards to nodes. Each cluster has a single master node that is elected from the master eligible nodes using a distributed consensus algorithm and is reelected if the current master node fails.
Coordinator or client node
Coordinator Nodes are nodes that do not hold any configured role. They don’t hold data, are not part of the master eligible group nor execute ingest pipelines. Coordinator nodes serve incoming search requests and act as the query coordinator running query and fetch phases, send requests to every node that holds a shard being queried. The client node also distributes bulk indexing operations and route queries to shards based on the node’s responsiveness.
Log Context
Log “Lock assertion failed” classname is NodeEnvironment.java
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
if (!closed.get() && locks != null) { for (Lock lock : locks) { try { lock.ensureValid(); } catch (IOException e) { logger.warn("lock assertion failed"; e); throw new IllegalStateException("environment is not locked"; e); } } } }
Run the Check-Up to get customized recommendations like this:

Heavy merges detected in specific nodes

Description
A large number of small shards can slow down searches and cause cluster instability. Some indices have shards that are too small…

Recommendations Based on your specific ES deployment you should…
Based on your specific ES deployment you should…
X-PUT curl -H [a customized code snippet to resolve the issue]