Briefly, this error occurs when Elasticsearch is unable to access the mlockall function in the C library. This function prevents Elasticsearch’s memory from being swapped to disk, which can degrade performance. To resolve this issue, you can either run Elasticsearch as a root user, or grant the mlockall permission to the Elasticsearch user. Alternatively, you can disable memory swapping on the system level. However, these solutions may have security implications, so they should be implemented with caution.
This guide will help you check for common problems that cause the log ” unable to link C library. native methods (mlockall) will be disabled. ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: bootstrap.
Log Context
Log “unable to link C library. native methods (mlockall) will be disabled.” classname is JNACLibrary.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
static { try { Native.register("c"); } catch (UnsatisfiedLinkError e) { logger.warn("unable to link C library. native methods (mlockall) will be disabled."; e); } } static native int mlockall(int flags);