ResourceAlreadyExistsException while running sgadmin

#1

I have a program which uses RestHighlevelClient to access the ES cluster.Through that program I am running sgadmin whenever required.

While running sgadmin i am getting the following Exception:

Clustername: CLUSTER
Clusterstate: GREEN
Number of nodes: 1
Number of data nodes: 1
searchguard index does not exists, attempt to create it … ERR: An unexpected ResourceAlreadyExistsException occured: index [searchguard/z0lApr9wS6uhCKdcKTe0Xw] already exists
Trace:
[searchguard/z0lApr9wS6uhCKdcKTe0Xw] ResourceAlreadyExistsException[index [searchguard/z0lApr9wS6uhCKdcKTe0Xw] already exists]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexName(MetaDataCreateIndexService.java:150)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:574)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$$Lambda$2051/2017730754.validate(Unknown Source)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$IndexCreationTask.execute(MetaDataCreateIndexService.java:289)
at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45)
at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:639)
at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:268)
at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:198)
at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:133)
at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150)
at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:244)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

The program automatically retries if there is any error.So for the second time sgadmin is running properly

Why is this happening please help me

assigned cstaley #2
#3

@cstaley can you have a look please?

#4

What do you mean with “Through that program I am running sgadmin whenever required.”?

The “ResourceAlreadyExistsException” exception occurs when another process concurrently also creating the searchguard index. Normally this should not happen. Can you please explain when and how you run sgadmin? It also looks like you run sgadmin the first time here because of “searchguard index does not exists, attempt to create it” which only will be the case if you never run sgadmin before.

Please also attach your elasticsearch.yml