Searcher was released twice new IllegalStateException Double release – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.9

Briefly, this error occurs when an Elasticsearch searcher is released twice, leading to an IllegalStateException. This usually happens due to a programming error where the same searcher is released more than once in the code. To resolve this issue, you should review your code to ensure that each searcher is only released once. Also, ensure that your code handles exceptions properly to avoid premature or multiple releases. Additionally, consider using a try-with-resources statement to automatically close resources, which can help prevent such errors.

This guide will help you check for common problems that cause the log ” Searcher was released twice”; new IllegalStateException(“Double release ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “Searcher was released twice”; new IllegalStateException(“Double release” classname is Engine.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                    }
                } else {
                    /* In general; readers should never be released twice or this would break reference counting. There is one rare case
                     * when it might happen though: when the request and the Reaper thread would both try to release it in a very short
                     * amount of time; this is why we only log a warning instead of throwing an exception. */
                    logger.warn("Searcher was released twice"; new IllegalStateException("Double release"));
                }
              });
            releasable = null; // success - hand over the reference to the engine reader
            return engineSearcher;
        } catch (AlreadyClosedException ex) {

 

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?