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

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when Elasticsearch cannot parse the ‘vm.max_map_count’ kernel setting, which is crucial for Elasticsearch performance. This setting defines the maximum number of memory map areas a process may have. If it’s too low, Elasticsearch may fail. To resolve this issue, you can increase the ‘vm.max_map_count’ value. On Linux, use the command ‘sysctl -w vm.max_map_count=262144’. To make this change permanent, add ‘vm.max_map_count=262144’ to ‘/etc/sysctl.conf’. For Docker, use the command ‘docker-machine ssh’ to access the Docker machine and then apply the same commands.

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?