diff --git a/distribution/src/main/resources/bin/elasticsearch-env b/distribution/src/main/resources/bin/elasticsearch-env index 211c872b9a5..e4be2625217 100644 --- a/distribution/src/main/resources/bin/elasticsearch-env +++ b/distribution/src/main/resources/bin/elasticsearch-env @@ -45,8 +45,7 @@ if [ ! -x "$JAVA" ]; then exit 1 fi -# don't let JAVA_TOOL_OPTIONS slip in (e.g. agents in Ubuntu); works around -# https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487 +# do not let JAVA_TOOL_OPTIONS slip in (as the JVM does by default) if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then echo "warning: ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS" unset JAVA_TOOL_OPTIONS diff --git a/distribution/src/main/resources/bin/elasticsearch-env.bat b/distribution/src/main/resources/bin/elasticsearch-env.bat index c1d6f43b15c..69bd697d28b 100644 --- a/distribution/src/main/resources/bin/elasticsearch-env.bat +++ b/distribution/src/main/resources/bin/elasticsearch-env.bat @@ -28,6 +28,12 @@ if not exist %JAVA% ( exit /b 1 ) +rem do not let JAVA_TOOL_OPTIONS slip in (as the JVM does by default) +if not "%JAVA_TOOL_OPTIONS%" == "" ( + echo "warning: ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS" + set JAVA_TOOL_OPTIONS= +) + rem JAVA_OPTS is not a built-in JVM mechanism but some people think it is so we rem warn them that we are not observing the value of %JAVA_OPTS% if not "%JAVA_OPTS%" == "" ( diff --git a/docs/reference/setup/sysconfig/configuring.asciidoc b/docs/reference/setup/sysconfig/configuring.asciidoc index 7ec9e1d405d..0473bed3a76 100644 --- a/docs/reference/setup/sysconfig/configuring.asciidoc +++ b/docs/reference/setup/sysconfig/configuring.asciidoc @@ -125,3 +125,16 @@ export ES_JAVA_OPTS="$ES_JAVA_OPTS -Djava.io.tmpdir=/path/to/temp/dir" When using the RPM or Debian packages, `ES_JAVA_OPTS` can be specified in the <>. + +The JVM has a built-in mechanism for observing the `JAVA_TOOL_OPTIONS` +environment variable. We intentionally ignore this environment variable in our +packaging scripts. The primary reason for this is that on some OS (e.g., Ubuntu) +there are agents installed by default via this environment variable that we do +not want interfering with Elasticsearch. + +Additionally, some other Java programs support the `JAVA_OPTS` environment +variable. This is *not* a mechanism built into the JVM but instead a convention +in the ecosystem. However, we do not support this environment variable, instead +supporting setting JVM options via the `jvm.options` file or the environment +variable `ES_JAVA_OPTS` as above. +