Unknown mlockall error – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 1.7-1.7

Briefly, this error occurs when Elasticsearch fails to lock the process address space into RAM, preventing any Elasticsearch memory from being swapped out. This is usually due to insufficient permissions or system limits. To resolve this, you can ensure that the user running Elasticsearch has the necessary permissions to lock memory. Alternatively, you can increase the system limits on locked memory. If these solutions don’t work, you can disable memory swapping in Elasticsearch, but this should be a last resort as it can lead to other issues.

This guide will help you check for common problems that cause the log ” Unknown mlockall error ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: bootstrap.

Log Context

Log “Unknown mlockall error” classname is JNANatives.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                 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);

    static void tryVirtualLock() {


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?