Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch 7.0.0-alpha2 elasticsearch-plugin \Common is not expected at this time. #38578

Closed
krisavi opened this issue Feb 7, 2019 · 5 comments · Fixed by #39712
Closed
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure

Comments

@krisavi
Copy link

krisavi commented Feb 7, 2019

Elasticsearch version
Version: 7.0.0-alpha2, Build: unknown/unknown/a30e8c2/2018-12-17T12:33:32.311168Z, JVM: 1.8.0_172

JVM version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

OS version
Windows Server 2012 R2 Datacenter

Description of the problem including expected versus actual behavior:
Expected to have plugin installed like it worked in previous version.

Steps to reproduce:
Upgraded from 6.3.2 to 7.0.0-alpha2 and during install when used old config it ran into errors.
Turned off geoip ingest plugin let the install to finish. Thought I can enable it again after install, but it seems it is not working.

>"C:\Program Files\Elastic\Elasticsearch\7.0.0-alpha2\bin\elasticsearch-plugin.bat" install ingest-geoip
\Common was unexpected at this time.

Did not upgrade Java, from google search it seemed that at some point java update caused similar issues, but this time Java was not updated.
Not sure if it is due to this error, but new version does not start.

[2019-02-07T17:30:24,021][ERROR][o.e.b.Bootstrap          ] [TDOSNELIN016] node validation exception
[1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.zen.ping.unicast.hosts, discovery.zen.hosts_provider, cluster.initial_master_nodes] must be configured
[2019-02-07T17:30:24,025][INFO ][o.e.n.Node               ] [TDOSNELIN016] stopping ...
[2019-02-07T17:30:24,126][INFO ][o.e.n.Node               ] [TDOSNELIN016] stopped
[2019-02-07T17:30:24,126][INFO ][o.e.n.Node               ] [TDOSNELIN016] closing ...
[2019-02-07T17:30:24,144][INFO ][o.e.n.Node               ] [TDOSNELIN016] closed
[2019-02-07T17:30:24,149][INFO ][o.e.x.m.p.NativeController] [TDOSNELIN016] Native controller process has stopped - no new native processes can be started
@gwbrown gwbrown added >bug :Core/Infra/Plugins Plugin API and infrastructure and removed >bug labels Feb 7, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@krisavi
Copy link
Author

krisavi commented Feb 7, 2019

Tracing it a bit down the rabbithole, it seems there is issue with elasticsearch-env.bat
When running elasticsearch-cli.bat manually last rows are:

>set ES_DISTRIBUTION_TYPE=zip
\Common was unexpected at this time.
>  for /f "tokens=* usebackq" %a in (`""C:\Program Files (x86)\Common Files\Oracle\Java
\javapath\java.exe" -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory""`) do set
 ES_TMPDIR=%a

These are coming from elasticsearch-env.bat

set ES_DISTRIBUTION_TYPE=zip

if not defined ES_TMPDIR (
  for /f "tokens=* usebackq" %%a in (`"%JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory""`) do set ES_TMPDIR=%%a
)

There seems to be extra " before %JAVA% and also one after "org.elasticsearch.tools.launchers.TempDirectory"
Since inner quotation is not escaped, it will cause problems with starting and ending string values.

I got it to work by changing last rows in elasticsearch-env.bat to

if not defined ES_TMPDIR (
  for /f "tokens=* usebackq" %%a in ('%JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory"') do set ES_TMPDIR=%%a
)

using ' instead of `" and "`

krisavi referenced this issue Feb 8, 2019
In the long run we want to move all of startup to a Java program. This
will simplify our startup scripts and make maintenance of startup less
dependent on the underlying platform that we run on. This commit moves
the creation of the temporary directory off of system-dependent commands
and onto a simple Java program.
@Mpdreamz
Copy link
Member

Mpdreamz commented Feb 8, 2019

Thanks for reporting this @krisavi a quick reproduction failed on my end though.

Using JAVA_HOME: "C:\Program Files\Java\jdk-11.0.1"

"c:\Temp\elasticsearch-7.0.0-alpha2 space\bin\elasticsearch-plugin.bat" install ingest-geoip

Installs fine on my end. Both ES_HOME and JAVA_HOME having spaces in their paths.

Will try and mimic your environment more closely next

@Mpdreamz
Copy link
Member

Mpdreamz commented Feb 8, 2019

Can reproduce if no JAVA_HOME is set and is inferred from the java.exe location in PATH.

Mpdreamz added a commit to Mpdreamz/elasticsearch that referenced this issue Feb 8, 2019
When %JAVA% gets inferred from %PATH% trying to resolve %ES_TMPDIR% failed.

If %JAVA_HOME% was set explicitly this did not cause an error.
@Mpdreamz
Copy link
Member

Mpdreamz commented Feb 8, 2019

Thanks again for reporting @krisavi I've opened #38624 to address this applying your fix.

pgomulka added a commit that referenced this issue Apr 2, 2019
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA
contains parentheses. This seems to be the limitation of FOR /F IN
(command) DO syntax.
The JAVA variable present in a command contains a path to a binary to
start elasticsearch (with spaces & parens). We can workaround the
problem of spaces and parentheses in this path by referring this
variable with a CALL command.
Note that executing binaries with CALL is an undocumented behaviour (but works)
closes #38578
closes #38624
closes #33405
closes #30606
pgomulka added a commit to pgomulka/elasticsearch that referenced this issue Apr 3, 2019
…39712)

the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA
contains parentheses. This seems to be the limitation of FOR /F IN
(command) DO syntax.
The JAVA variable present in a command contains a path to a binary to
start elasticsearch (with spaces & parens). We can workaround the
problem of spaces and parentheses in this path by referring this
variable with a CALL command.
Note that executing binaries with CALL is an undocumented behaviour (but works)
closes elastic#38578
closes elastic#38624
closes elastic#33405
closes elastic#30606
pgomulka added a commit to pgomulka/elasticsearch that referenced this issue Apr 4, 2019
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA
contains parentheses. This seems to be the limitation of FOR /F IN
(command) DO syntax.
The JAVA variable present in a command contains a path to a binary to
start elasticsearch (with spaces & parens). We can workaround the
problem of spaces and parentheses in this path by referring this
variable with a CALL command.
Note that executing binaries with CALL is an undocumented behaviour (but works)
closes elastic#38578
closes elastic#38624
closes elastic#33405
closes elastic#30606
pgomulka added a commit to pgomulka/elasticsearch that referenced this issue Apr 4, 2019
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA
contains parentheses. This seems to be the limitation of FOR /F IN
(command) DO syntax.
The JAVA variable present in a command contains a path to a binary to
start elasticsearch (with spaces & parens). We can workaround the
problem of spaces and parentheses in this path by referring this
variable with a CALL command.
Note that executing binaries with CALL is an undocumented behaviour (but works)
closes elastic#38578
closes elastic#38624
closes elastic#33405
closes elastic#30606
pgomulka added a commit that referenced this issue Apr 5, 2019
…40768)

the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA
contains parentheses. This seems to be the limitation of FOR /F IN
(command) DO syntax.
The JAVA variable present in a command contains a path to a binary to
start elasticsearch (with spaces & parens). We can workaround the
problem of spaces and parentheses in this path by referring this
variable with a CALL command.
Note that executing binaries with CALL is an undocumented behaviour (but works)
closes #38578
closes #38624
closes #33405
closes #30606
backports:
* Bat scripts to work with JAVA_HOME with parentheses(#39712)
* Link to SYSTEM_JAVA_HOME on windows (#40806)
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this issue May 27, 2019
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA
contains parentheses. This seems to be the limitation of FOR /F IN
(command) DO syntax.
The JAVA variable present in a command contains a path to a binary to
start elasticsearch (with spaces & parens). We can workaround the
problem of spaces and parentheses in this path by referring this
variable with a CALL command.
Note that executing binaries with CALL is an undocumented behaviour (but works)
closes elastic#38578
closes elastic#38624
closes elastic#33405
closes elastic#30606
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants