Unable to lock JVM memory ENOMEM – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 1.7-1.7

Briefly, this error occurs when Elasticsearch is unable to lock the JVM memory due to insufficient system memory or incorrect configuration settings. This could lead to performance issues. To resolve this, you can increase the system’s memory or adjust the Elasticsearch configuration settings. Ensure that the ‘bootstrap.memory_lock’ is set to true and the ‘ES_HEAP_SIZE’ is set to an appropriate value. Also, check the system’s ulimit settings and increase them if necessary. Lastly, ensure that the user running Elasticsearch has the necessary permissions to lock memory.

This guide will help you check for common problems that cause the log ” Unable to lock JVM memory (ENOMEM). ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: bootstrap and memory.

Log Context

Log “Unable to lock JVM memory (ENOMEM).” classname is JNANatives.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

             return;
        }

        if (errno != Integer.MIN_VALUE) {
            if (errno == JNACLibrary.ENOMEM && System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("linux")) {
                logger.warn("Unable to lock JVM memory (ENOMEM)."
                        + " This can result in part of the JVM being swapped out."
                        + " Increase RLIMIT_MEMLOCK (ulimit).");
            } else if (!System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("mac")) {
                // OS X allows mlockall to be called; but always returns an error
                logger.warn("Unknown mlockall error " + errno);




 

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?