Cannot compute used memory when total memory is 0 and free memory is – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.7-7.8

Briefly, this error occurs when Elasticsearch is unable to calculate the used memory because the total memory is zero and the free memory is also zero. This could be due to a misconfiguration in the system settings or a lack of available system resources. To resolve this issue, you can try increasing the total memory allocated to Elasticsearch, ensure that the system has enough resources, or check the system settings to ensure that memory allocation is correctly configured.

This guide will help you check for common problems that cause the log ” cannot compute used memory when total memory is 0 and free memory is ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: monitor, memory.

Log Context

Log “cannot compute used memory when total memory is 0 and free memory is ” classname is OsStats.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                // we can no longer correctly report the used memory as (total-free) and should report it as zero.
                //
                // We intentionally check for (total == 0) rather than (total - free  total) which would be a different bug.
                if (free > 0) {
                    logger.warn("cannot compute used memory when total memory is 0 and free memory is " + free);
                }
                return new ByteSizeValue(0);
            }
            return new ByteSizeValue(total - free);
        }

 

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?