OS reported a negative total swap space size – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.7-7.8

Briefly, this error occurs when Elasticsearch’s JVM (Java Virtual Machine) tries to retrieve the total swap space size from the operating system, but gets a negative value. This could be due to a bug in the JVM or the operating system. To resolve this issue, you can either upgrade your JVM to the latest version or disable the swap check by setting the “bootstrap.memory_lock” to false in the Elasticsearch configuration file. Alternatively, you can also configure your operating system to correctly report the swap space size.

This guide will help you check for common problems that cause the log ” OS reported a negative total swap space size [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: monitor.

Log Context

Log “OS reported a negative total swap space size [{}]” classname is OsProbe.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

            return 0;
        }
        try {
            final long mem = (long) getTotalSwapSpaceSize.invoke(osMxBean);
            if (mem 


 

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?