Elasticsearch: Unable to Install ES7.9.2 as Windows Service with ES_JAVA_OPTS in env var

Created on 22 Oct 2020  路  6Comments  路  Source: elastic/elasticsearch

Elasticsearch version (bin/elasticsearch --version): ES 7.9.2

Plugins installed: []

JVM version (java -version): Bundled JDK

OS version (uname -a if on a Unix-like system): Windows 10

Description of the problem including expected versus actual behavior:
Unable to install elasticsearch as windows service when we set Xms and Xmx via windows env var ES_JAVA_OPTS
installation is okay if heap is set via jvm_options file.

Steps to reproduce:

  1. Set ES_JAVA_OPTS env var with: -Xms4g -Xmx4g
  2. Try to install Elasticsearch as a Windows service with
    elasticsearch-service.bat install
  3. Installation failed due to semicolon being added in between the heap config.

Provide logs (if relevant):

D:\ES7_test\elasticsearch-7.9.2\bin>echo %ES_JAVA_OPTS%
-Xms4g -Xmx4g

D:\ES7_test\elasticsearch-7.9.2\bin>elasticsearch-service.bat install
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  ""D:\ES7_test\elasticsearch-7.9.2\jdk""
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:

error:
Invalid initial heap size: -Xms4g;-Xmx4g
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
        at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:126)
        at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:88)
        at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:59)
        at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:137)
        at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:95)
:DeliverPackaging >bug Delivery

All 6 comments

Pinging @elastic/es-core-infra (:Core/Infra/Packaging)

@williamrandolph Can you take a look at this? Seems it might be related to the change you made in https://github.com/elastic/elasticsearch/pull/57769.

is there any workaround we can use as temporary measure?
maybe some patch on the elasticsearch-service.bat file?

@dbakti7 I've reproduced the bug and will create a PR with a code change shortly. Thank you for reporting this.

@dbakti7 If you want to try out the changes I'm making, there is a diff for elasticsearch-service.bat on this pull request: https://github.com/elastic/elasticsearch/pull/64254

@williamrandolph patch works perfectly! thank you!
and we are also looking forward to the official fix in 7.9.4! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasontedor picture jasontedor  路  3Comments

rpalsaxena picture rpalsaxena  路  3Comments

rjernst picture rjernst  路  3Comments

Praveen82 picture Praveen82  路  3Comments

jpountz picture jpountz  路  3Comments