State was mutated while calculating new CS update – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.17

Briefly, this error occurs when there’s a concurrent modification of the cluster state while Elasticsearch is calculating a new cluster state update. This could be due to multiple threads trying to update the state simultaneously. To resolve this, ensure that cluster state updates are performed in a single thread to avoid concurrency issues. Also, check for any bugs in the Elasticsearch version you’re using, as this could be a known issue. Upgrading to a newer version might help. Lastly, ensure your cluster has enough resources to handle the load, as resource constraints can cause such issues.

This guide will help you check for common problems that cause the log ” state was mutated while calculating new CS update ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: discovery.

Log Context

Log “state was mutated while calculating new CS update” class name is ZenDiscovery.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 try {  // state got changed locally (maybe because another master published to us)
 if (clusterStatePublicationEvent.getOldState() != this.committedState.get()) {
 throw new FailedToCommitClusterStateException("state was mutated while calculating new CS update");
 }  pendingStatesQueue.addPending(newState);  publishClusterState.publish(clusterStatePublicationEvent; electMaster.minimumMasterNodes(); ackListener);

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?