Skip to content

Default jvm.options incompatible with bundled JDK in elasticsearch 7 #1032

Open
@6uhrmittag

Description

@6uhrmittag
  • Module version: mod 'elastic-elasticsearch', '6.3.3'
  • Puppet version: PuppetBolt 1.10.0
  • OS and version: Ubuntu 16.04.6 LTS

Bug description

The Module defaults in jvm.options are not compatible with the bundled Java in elasticsearch 7. Elasticsearch won't start with the example Puppet manifest.

Reproduce

With:

elasticsearch::instance { 'es-01':
  config      => {
    #  'xpack.monitoring.collection.enabled' => true,
    'network.host' => '127.0.0.1',
    'http.port'    => '8200',
  }
}

Result: Elasticsearch won't start.

Syslog:

Apr 22 18:18:49 ip-172-31-35-88 elasticsearch[18037]: Unrecognized VM option 'PrintGCApplicationStoppedTime'
Apr 22 18:18:49 ip-172-31-35-88 elasticsearch[18037]: Error: Could not create the Java Virtual Machine.
Apr 22 18:18:49 ip-172-31-35-88 elasticsearch[18037]: Error: A fatal exception has occurred. Program will exit.
Apr 22 18:18:49 ip-172-31-35-88 systemd[1]: elasticsearch-es-01.service: Main process exited, code=exited, status=1/FAI
LURE
Apr 22 18:18:49 ip-172-31-35-88 systemd[1]: elasticsearch-es-01.service: Unit entered failed state.
Apr 22 18:18:49 ip-172-31-35-88 systemd[1]: elasticsearch-es-01.service: Failed with result 'exit-code'.

The generated jvm.options:

root@xxxx:/etc/elasticsearch/es-01# cat jvm.options
# This file is managed by Puppet -- es-01
#
# Set the 'jvm_options' parameter on the elasticsearch class to change this file.

-Dfile.encoding=UTF-8
-Dio.netty.noKeySetOptimization=true
-Dio.netty.noUnsafe=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Djava.awt.headless=true
-Djna.nosys=true
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-XX:+AlwaysPreTouch
-XX:+HeapDumpOnOutOfMemoryError
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+PrintTenuringDistribution
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseConcMarkSweepGC
-XX:+UseGCLogFileRotation
-XX:-OmitStackTraceInFastThrow
-XX:CMSInitiatingOccupancyFraction=75
-XX:GCLogFileSize=64m
-XX:NumberOfGCLogFiles=32
-Xloggc:/var/log/elasticsearch/es-01/gc.log
-Xms2g
-Xmx2g
-Xss1m
-server

expected behavior

The latest Elasticsearch should start with Module default values.

workaround

My workaround is to disable certain options. I disabled options until elasticsearch started - so only a quick and dirty fix:

elasticsearch::instance { 'es-01':
  jvm_options => [
    '-Xms2g',
    '-Xmx2g',
    '#PrintGCDetails',
    '#PrintGCDateStamps',
    '#PrintTenuringDistribution',
    '#PrintGCApplicationStoppedTime',
    "#Xloggc",
    '#UseGCLogFileRotation',
    "#NumberOfGCLogFiles",
    "#GCLogFileSize",
    "#XX:UseConcMarkSweepGC",
  ],
  config      => {
    #  'xpack.monitoring.collection.enabled' => true,
    'network.host' => '127.0.0.1',
    'http.port'    => '8200',
  }
}

Suggestion

It looks like the bundled Java is a Oracle Java 12:

root@xxx:/usr/share/elasticsearch/jdk# cat release
IMPLEMENTOR="Oracle Corporation"
JAVA_VERSION="12"
JAVA_VERSION_DATE="2019-03-19"

I don't know the specifics, but the elasticsearch documentation suggest to add versions to the jvm.options: https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html this may prevents this with future versions.

8-9:-Xmx2g

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions