Unable to parse vm max map count – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-8.2

Briefly, this error occurs when Elasticsearch cannot parse the ‘vm.max_map_count’ setting, which defines the maximum number of memory map areas a process can have. This could be due to incorrect configuration or insufficient system resources. To resolve this issue, you can increase the ‘vm.max_map_count’ value in the system configuration file. Alternatively, you can also set this value temporarily by using the command ‘sysctl -w vm.max_map_count=value’. Ensure that the value is appropriate for your system’s resources to avoid overconsumption.

We recommend you run Elasticsearch Error Check-Up which can resolve issues that cause many errors.

Advanced users might want to skip right to the common problems section in each concept or try running the Check-Up which analyses ES to pinpoint the cause of many errors and provides suitable actionable recommendations how to resolve them (free tool that requires no installation).

vm.max_map_count is defined as a Long data type in Elasticsearch.  This method in BootstrapChecks.java tries to convert it from String(Read in Sting) to the Long data type. If you define a `vm.max_map_count` which can’t be converted to Long, then Elasticsearch throws NumberFormatException and logs below Error:
 unable to parse vm.max_map_count 

Log Context

Log “unable to parse vm.max_map_count [{}]” classname is BootstrapChecks.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                final String rawProcSysVmMaxMapCount = readProcSysVmMaxMapCount(bufferedReader);
                if (rawProcSysVmMaxMapCount != null) {
                    try {
                        return parseProcSysVmMaxMapCount(rawProcSysVmMaxMapCount);
                    } catch (final NumberFormatException e) {
                        logger.warn(() -> new ParameterizedMessage("unable to parse vm.max_map_count [{}]"; rawProcSysVmMaxMapCount); e);
                    }
                }
            } catch (final IOException e) {
                logger.warn(() -> new ParameterizedMessage("I/O exception while trying to read [{}]"; path); e);
            }

 

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?