# Launch4j and Elasticsearch bootstrap heap errors

**URL:** <https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430>\
**Category:** Elasticsearch\
**Created:** [May 3, 2017, 2:46pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430 "2017-05-03T14:46:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luckyj13](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luckyj13/32/24522_2.png) [@Luckyj13](https://discuss.elastic.co/u/Luckyj13)\
**Post date:** [May 3, 2017, 2:46pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/1 "2017-05-03T14:46:34Z")

</div>

Hi, all.  
I have been running into a Error with the heap sizes when trying to start Elasticsearch. I have been looking through the group looking for a answer that works, and haven't seen to find it. -Xms and -Xmx are both set to 30gb for me in the ini file that should be loaded when the wrapper exe starts.

We are launching the jar through launch4j and as part of that an ini file is created that contains the heap settings.  
**Error:**  
""[2017-05-02T23:13:00,977][INFO][org.elasticsearch.transport.TransportService] publish\_address {25.130.116.179:9301},  
bound\_addresses {25.130.116.179:9301}, {[::1]:9301}, {127.0.0.1:9301}  
""[2017-05-02T23:13:00,993][INFO][org.elasticsearch.bootstrap.BootstrapChecks] bound or publishing to a non-loopback or  
non-link-local address, enforcing bootstrap checks  
"ERROR: bootstrap checks failed  
initial heap size [2147483648] not equal to maximum heap size [32210157568]; this can cause resize pauses and prevents m  
lockall from locking the entire heap  
"[2017-05-02T23:13:01,008][INFO][org.elasticsearch.node.Node] stopping ...  
""[2017-05-02T23:13:01,024][INFO][org.elasticsearch.node.Node] stopped  
""[2017-05-02T23:13:01,024][INFO][org.elasticsearch.node.Node] closing ...  
""[2017-05-02T23:13:01,039][TRACE][org.elasticsearch.node.Node] Close times for each service:  
StopWatch 'node\_close': running time = 0s

**launch4j xml**

```
   <?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
  <dontWrapJar>true</dontWrapJar>
  <headerType>console</headerType>
  <jar></jar>
  <outfile>Elasticsearch.exe</outfile>
  <errTitle></errTitle>
  <cmdLine></cmdLine>
  <chdir>.</chdir>
  <priority>normal</priority>
  <downloadUrl>http://java.com/download</downloadUrl>
  <supportUrl></supportUrl>
  <stayAlive>false</stayAlive>
  <manifest></manifest>
  <icon>elasticsearch.ico</icon>
  <versionInfo>
    <fileVersion>5.3.1.0</fileVersion>
    <txtFileVersion>5.3.1</txtFileVersion>
    <productVersion>5.3.1.0</productVersion>
    <txtProductVersion>5.3.1</txtProductVersion>
    <productName>Elasticsearch</productName>
    <fileDescription>Elasticsearch Launcher</fileDescription>
    <copyright>Apache License v2.0</copyright>
    <companyName>Elastic</companyName>
    <internalName>Elasticsearch</internalName>
    <originalFilename>Elasticsearch.exe</originalFilename>
  </versionInfo>
  <singleInstance>
    <mutexName>elasticsearch</mutexName>
    <windowTitle></windowTitle>
  </singleInstance>
  <classPath>
    <mainClass>org.elasticsearch.bootstrap.Elasticsearch</mainClass>
    <cp>%EXEDIR%/lib/elasticsearch-5.3.1.jar</cp>
    <cp>%EXEDIR%/lib/*</cp>
  </classPath>
  <jre>
    <path>%EXEDIR%/../jre</path>
    <bundledJre64Bit>true</bundledJre64Bit>
    <minVersion>1.7.0</minVersion>
    <maxVersion></maxVersion>
    <jdkPreference>preferJre</jdkPreference>
    <runtimeBits>64/32</runtimeBits>
    <!-- Warning: Do not set -Xms and -Xmx here! They would override the settings in elasticsearch_config.ini -->
    <opt>-Xss1m</opt>
    <opt>-Djava.awt.headless=true</opt>
    <opt>-XX:+UseParNewGC</opt>
    <opt>-XX:+UseConcMarkSweepGC</opt>
    <opt>-XX:+UseCondCardMark</opt>
    <opt>-XX:CMSInitiatingOccupancyFraction=75</opt>
    <opt>-XX:+UseCMSInitiatingOccupancyOnly</opt>
    <opt>-XX:+AlwaysPreTouch</opt>
    <opt>-XX:+HeapDumpOnOutOfMemoryError</opt>
    <opt>-XX:+DisableExplicitGC</opt>
    <opt>-XX:HeapDumpPath=%DATADIR%/minidumps/esheapdump.hprof</opt>
    <opt>-Dfile.encoding=UTF-8</opt>
    <opt>-Djna.nosys=true</opt>
    <opt>-Dmapper.allow_dots_in_name=true</opt>
    <opt>-Delasticsearch -Des-foreground=yes -Des.path.home=&quot;%EXEDIR%&quot;</opt>
    <opt>-Dlog4j2.disable.jmx=true</opt>
    <opt>-Dlog4j.skipJansi=true</opt>
    <opt>-Dio.netty.noUnsafe=true</opt>
    <opt>-Dio.netty.noKeySetOptimization=true</opt>
    <opt>-Dio.netty.recycler.maxCapacityPerThread=0</opt>
    <opt>-Dlog4j.shutdownHookEnabled=false</opt>
    <opt>-XX:+PrintFlagsFinal</opt>

  </jre>
</launch4jConfig>

```

**elasticsearch.yml**

```
 cluster:
  name: ${_ES_CLUSTERNAME}
  routing:
    allocation:
      awareness.attributes: scale_unit
      disk.watermark.low: 80%
      disk.watermark.high: 85%
#
# ------------------------------------ Node ------------------------------------
#
node:
  name: ${COMPUTERNAME}
  attr.scale_unit: ${_ES_SCALEUNIT}
  max_local_storage_nodes: 1
  master: ${_ES_ISMASTER}
  data: ${_ES_ISDATA}
#
# ----------------------------------- Paths ------------------------------------
#
path:
  data: ${_ES_DATAPATH}
  logs: ${_ES_LOGPATH}
#
# ---------------------------------- Network -----------------------------------
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
network:
  host: ${COMPUTERNAME}
  bind_host: ${COMPUTERNAME}, _local_
#
http.enabled: ${_ES_ISHTTP}
#
# --------------------------------- Discovery ----------------------------------
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
discovery:
  zen:
    ping.unicast.hosts: ${_ES_MASTER_NODES}
    fd.ping_interval: 1s
    fd.ping_timeout: 10s
    fd.ping_retries: 3
    minimum_master_nodes: ${_ES_MASTERS_MIN}
#
# ---------------------------------- Gateway -----------------------------------
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
gateway:
  recover_after_time: 10m
  expected_nodes: ${_ES_MACHINE_COUNT}
#
# ----------------------------------- Index ------------------------------------
#

# Enable http compression for requests and response
http.compression: true
```

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [May 3, 2017, 6:41pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/2 "2017-05-03T18:41:37Z")

</div>

We do not support this.

```auto
ERROR: bootstrap checks failed
initial heap size [2147483648] not equal to maximum heap size [32210157568]; this can cause resize pauses and prevents mlockall from locking the entire heap

```

It's clear the JVM thinks you only have the minimum heap size set to 2g.

```auto
    <!-- Warning: Do not set -Xms and -Xmx here! They would override the settings in elasticsearch_config.ini -->

```

You did not show the contents of this file.

---

<div class="post-metadata">

**Author:** ![Luckyj13](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luckyj13/32/24522_2.png) [@Luckyj13](https://discuss.elastic.co/u/Luckyj13)\
**Post date:** [May 3, 2017, 6:55pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/3 "2017-05-03T18:55:05Z")

</div>

> [@jasontedor](#):
>
> did not show the contents of this file.

The contents of the INI file is  
-Xms30  
-Xmx30

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [May 3, 2017, 10:16pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/4 "2017-05-03T22:16:22Z")

</div>

That can not possibly be the contents of the file, that would be setting the heap to 30 bytes, the JVM will reject that. Or, the file is in fact not being picked up at all and maybe you should find out why? Or, you did not show the exact contents of the file?

Either way, I want to be clear about expectations here: it's unlikely that anyone is going sink a lot of time into this one. We have supported ways of starting Elasticsearch, this is not one of them.

My first recommendation would be to double check that the ini file is in fact being used. You could, for example, set the max heap to 15g and see if it gets picked up. If you do see that the ini file is in fact being used, my second recommendation would be to set `network.host` and `network.bind_host` to `localhost` only to disable the bootstrap checks. After the JVM starts, use `jps -l -m -v` to see the flags that were used to start the JVM and see what the heap flags are.

---

<div class="post-metadata">

**Author:** ![Luckyj13](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luckyj13/32/24522_2.png) [@Luckyj13](https://discuss.elastic.co/u/Luckyj13)\
**Post date:** [May 3, 2017, 10:20pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/5 "2017-05-03T22:20:43Z")

</div>

that was a direct copy form the file. I totally understand the not supported thing. I will take a look at what you suggested and hope that helps me uncover the issue.  
Thanks!

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [May 3, 2017, 11:00pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/6 "2017-05-03T23:00:06Z")

</div>

If that's directly from the file then it's not being picked up, those heap settings (30 bytes, `-Xms30` and `-Xmx30`) would cause the JVM to simply not start.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 31, 2017, 11:00pm UTC](https://discuss.elastic.co/t/launch4j-and-elasticsearch-bootstrap-heap-errors/84430/7 "2017-05-31T23:00:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
