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 :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
return 0;
}
try {
final long mem = (long) getTotalSwapSpaceSize.invoke(osMxBean);
if (mem
<p> </p>
<p> [ratemypost]</p>
return 0; } try { final long mem = (long) getTotalSwapSpaceSize.invoke(osMxBean); if (mem <p> </p> <p> [ratemypost]</p>
            return 0;
        }
        try {
            final long mem = (long) getTotalSwapSpaceSize.invoke(osMxBean);
            if (mem 


 

 [ratemypost]

Opster
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.