Skip to content

/_cat/indices: race condition/exception thrown when creating/deleting indices rapidly  #17395

@joshuar

Description

@joshuar

Elasticsearch Versions:
2.1.x - 2.2.x

JVM Version:
OpenJDK 64-Bit Server VM (build 25.77-b03, mixed mode)

Description of the problem including expected versus actual behavior:

It looks like if you create and delete indices very rapidly you can sometimes end up getting a 404 index_not_found_exception from the /_cat/indices API. So basically rather than seeing the indices that still exist, you get an exception because one index was created and deleted between when the endpoint resolves indices and then call indices stats api for those indices.

Steps to reproduce:

Attached is a script that should hopefully reproduce the problem, but it can take some time (few minutes depending on the ability of your ES cluster to handle responses :)

cat-indices-issue.sh.zip

The script is Bash. It will run a number of background processes that simply spin creating and then deleting an index with the REST API. The script waits until the output of _cat/indices produces the exception, then exits. NOTE: It will clean-up any background processes it creates but won't clean up any test indices that might still exist.

When the script dies, it will produce output like:

{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"testindex3","index":"testindex3"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"testindex3","index":"testindex3"},"status":404}
...output of the script cleaning up after itself...

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Distributed Coordination/AllocationAll issues relating to the decision making around placing a shard (both master logic & on the nodes)>bughelp wantedadoptme

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions