0.90.5 - service.bat terminates unexpectedly


(Mark Carpenter) #1

When trying to install Elasticsearch as a service using the provided batch
script, it terminates without giving any console output. When
double-clicked in Windows explorer, the command window appears and exits
immediately. When run from a command window, nothing happens.

Removing '@echo off' from service.bat and trying again yields the following:

C:\elasticsearch-0.90.5\bin>SETLOCAL
C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err
C:\elasticsearch-0.90.5\bin>set SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\
C:\elasticsearch-0.90.5\bin>for %I in ("C:\elasticsearch-0.90.5\bin..") do
set ES_HOME=%~dpfI
C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5
C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out
appropriate executable to use
C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java -version
2>&1 | find "64-Bit" 1>nul:

I am able to run elasticsearch.bat without any problem - I can index,
search, and discover other nodes.

Other useful info:

  • Elasticsearch Version 0.90.5
  • Windows Server 2012 Datacenter x64 (Hosted in Azure)
  • JRE 1.7.0_40-b43

Any ideas?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Costin Leau) #2

Looks like the spaces in the java definition break the version detection - adding quotes around it should help (I'll fix
this shortly in trunk and 0.90).
In the meantime you could either add the quotes yourself or use a symlink without spaces:

mklink /D /J "c:\jvm" "c:\Program Files\Java"

By the way, note that you are using a JRE not the JDK which means Elasticsearch will run in client mode only.

Cheers,

On 18/09/2013 3:57 PM, Mark Carpenter wrote:

When trying to install Elasticsearch as a service using the provided batch script, it terminates without giving any
console output. When double-clicked in Windows explorer, the command window appears and exits immediately. When run from
a command window, nothing happens.

Removing '@echo off' from service.bat and trying again yields the following:

C:\elasticsearch-0.90.5\bin>SETLOCAL
C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err
C:\elasticsearch-0.90.5\bin>set SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\
C:\elasticsearch-0.90.5\bin>for %I in ("C:\elasticsearch-0.90.5\bin\..") do set ES_HOME=%~dpfI
C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5
C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out appropriate executable to use
C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java -version   2>&1  | find "64-Bit"  1>nul:

I am able to run elasticsearch.bat without any problem - I can index, search, and discover other nodes.

Other useful info:

  • Elasticsearch Version 0.90.5
  • Windows Server 2012 Datacenter x64 (Hosted in Azure)
  • JRE 1.7.0_40-b43

Any ideas?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Costin Leau) #3

I've pushed a fix for your issue in 0.90 and master:

It would be great if you could test it out.

Thanks,

On 18/09/2013 3:57 PM, Mark Carpenter wrote:

When trying to install Elasticsearch as a service using the provided batch script, it terminates without giving any
console output. When double-clicked in Windows explorer, the command window appears and exits immediately. When run from
a command window, nothing happens.

Removing '@echo off' from service.bat and trying again yields the following:

C:\elasticsearch-0.90.5\bin>SETLOCAL
C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err
C:\elasticsearch-0.90.5\bin>set SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\
C:\elasticsearch-0.90.5\bin>for %I in ("C:\elasticsearch-0.90.5\bin\..") do set ES_HOME=%~dpfI
C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5
C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out appropriate executable to use
C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java -version   2>&1  | find "64-Bit"  1>nul:

I am able to run elasticsearch.bat without any problem - I can index, search, and discover other nodes.

Other useful info:

  • Elasticsearch Version 0.90.5
  • Windows Server 2012 Datacenter x64 (Hosted in Azure)
  • JRE 1.7.0_40-b43

Any ideas?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Caio D'Angelo) #4

I tested and the proposed solution works fine.

Thanks.

Em quarta-feira, 18 de setembro de 2013 11h38min14s UTC-3, Costin Leau
escreveu:

I've pushed a fix for your issue in 0.90 and master:
https://github.com/elasticsearch/elasticsearch/issues/3725

It would be great if you could test it out.

Thanks,

On 18/09/2013 3:57 PM, Mark Carpenter wrote:

When trying to install Elasticsearch as a service using the provided
batch script, it terminates without giving any
console output. When double-clicked in Windows explorer, the command
window appears and exits immediately. When run from
a command window, nothing happens.

Removing '@echo off' from service.bat and trying again yields the
following:

C:\elasticsearch-0.90.5\bin>SETLOCAL 
C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err 
C:\elasticsearch-0.90.5\bin>set 

SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\

C:\elasticsearch-0.90.5\bin>for %I in 

("C:\elasticsearch-0.90.5\bin..") do set ES_HOME=%~dpfI

C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5 
C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out 

appropriate executable to use

C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java 

-version 2>&1 | find "64-Bit" 1>nul:

I am able to run elasticsearch.bat without any problem - I can index,
search, and discover other nodes.

Other useful info:

  • Elasticsearch Version 0.90.5
  • Windows Server 2012 Datacenter x64 (Hosted in Azure)
  • JRE 1.7.0_40-b43

Any ideas?

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to
elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Costin Leau) #5

Thanks for the quick feedback and sorry for the inconvenience.

Cheers,

On 18/09/2013 10:53 PM, Caio D'Angelo wrote:

I tested and the proposed solution works fine.

Thanks.

Em quarta-feira, 18 de setembro de 2013 11h38min14s UTC-3, Costin Leau escreveu:

I've pushed a fix for your issue in 0.90 and master:
https://github.com/elasticsearch/elasticsearch/issues/3725 <https://github.com/elasticsearch/elasticsearch/issues/3725>

It would be great if you could test it out.

Thanks,

On 18/09/2013 3:57 PM, Mark Carpenter wrote:
> When trying to install Elasticsearch as a service using the provided batch script, it terminates without giving any
> console output. When double-clicked in Windows explorer, the command window appears and exits immediately. When run from
> a command window, nothing happens.
>
> Removing '@echo off' from service.bat and trying again yields the following:
>
>     C:\elasticsearch-0.90.5\bin>SETLOCAL
>     C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err
>     C:\elasticsearch-0.90.5\bin>set SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\
>     C:\elasticsearch-0.90.5\bin>for %I in ("C:\elasticsearch-0.90.5\bin\..") do set ES_HOME=%~dpfI
>     C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5
>     C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out appropriate executable to use
>     C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java -version   2>&1  | find "64-Bit"  1>nul:
>
> I am able to run elasticsearch.bat without any problem - I can index, search, and discover other nodes.
>
> Other useful info:
>
>   * Elasticsearch Version 0.90.5
>   * Windows Server 2012 Datacenter x64 (Hosted in Azure)
>   * JRE 1.7.0_40-b43
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
>elasticsearc...@googlegroups.com <javascript:>.
> For more options, visithttps://groups.google.com/groups/opt_out <https://groups.google.com/groups/opt_out>.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Mark Carpenter) #6

Costin,

Thanks for the quick feedback! I finally got some time to revisit this, and
your suggestion to use a path without spaces worked great! Instead of
adding quotes or creating a symlink, I changed the JAVA_HOME environment
variable to C:\Progra~1\Java\jdk.... Also, leaving it pointed at the JRE
path caused starting the service to fail (couldn't find jvm.dll, according
to the error logs), so I switched it to the JDK path.

In any event, you've been very helpful - thank you!

-Mark

On Wednesday, September 18, 2013 3:57:00 PM UTC-4, Costin Leau wrote:

Thanks for the quick feedback and sorry for the inconvenience.

Cheers,

On 18/09/2013 10:53 PM, Caio D'Angelo wrote:

I tested and the proposed solution works fine.

Thanks.

Em quarta-feira, 18 de setembro de 2013 11h38min14s UTC-3, Costin Leau
escreveu:

I've pushed a fix for your issue in 0.90 and master: 
https://github.com/elasticsearch/elasticsearch/issues/3725 <

https://github.com/elasticsearch/elasticsearch/issues/3725>

It would be great if you could test it out. 

Thanks, 

On 18/09/2013 3:57 PM, Mark Carpenter wrote: 
> When trying to install Elasticsearch as a service using the 

provided batch script, it terminates without giving any

> console output. When double-clicked in Windows explorer, the 

command window appears and exits immediately. When run from

> a command window, nothing happens. 
> 
> Removing '@echo off' from service.bat and trying again yields the 

following:

> 
>     C:\elasticsearch-0.90.5\bin>SETLOCAL 
>     C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err 
>     C:\elasticsearch-0.90.5\bin>set 

SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\

>     C:\elasticsearch-0.90.5\bin>for %I in 

("C:\elasticsearch-0.90.5\bin..") do set ES_HOME=%~dpfI

>     C:\elasticsearch-0.90.5\bin>set 

ES_HOME=C:\elasticsearch-0.90.5

>     C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure 

out appropriate executable to use

>     C:\elasticsearch-0.90.5\bin>C:\Program 

Files\Java\jre7\bin\java -version 2>&1 | find "64-Bit" 1>nul:

> 
> I am able to run elasticsearch.bat without any problem - I can 

index, search, and discover other nodes.

> 
> Other useful info: 
> 
>   * Elasticsearch Version 0.90.5 
>   * Windows Server 2012 Datacenter x64 (Hosted in Azure) 
>   * JRE 1.7.0_40-b43 
> 
> Any ideas? 
> 
> -- 
> You received this message because you are subscribed to the Google 

Groups "elasticsearch" group.

> To unsubscribe from this group and stop receiving emails from it, 

send an email to

>elasticsearc...@googlegroups.com <javascript:>. 
> For more options, visithttps://groups.google.com/groups/opt_out <

https://groups.google.com/groups/opt_out>.

-- 
Costin 

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to
elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Costin Leau) #7

Glad to hear it worked. I've added another improvement to service.bat to allow ES to run under JRE (this means using a
client JVM so service.bat gives you a warning) but also to do some basic JAVA_HOME detection in case the path is invalid.
This should prevent some issues when using incorrect settings and make the script more reliable.

The fix is available in both master and 0.90 branch [1]. Feedback is welcome!

Cheers,

[1] https://github.com/elasticsearch/elasticsearch/issues/3739

On 19/09/2013 3:46 PM, Mark Carpenter wrote:

Costin,

Thanks for the quick feedback! I finally got some time to revisit this, and your suggestion to use a path without spaces
worked great! Instead of adding quotes or creating a symlink, I changed the JAVA_HOME environment variable to
C:\Progra~1\Java\jdk.... Also, leaving it pointed at the JRE path caused starting the service to fail (couldn't find
jvm.dll, according to the error logs), so I switched it to the JDK path.

In any event, you've been very helpful - thank you!

-Mark

On Wednesday, September 18, 2013 3:57:00 PM UTC-4, Costin Leau wrote:

Thanks for the quick feedback and sorry for the inconvenience.

Cheers,

On 18/09/2013 10:53 PM, Caio D'Angelo wrote:
> I tested and the proposed solution works fine.
>
> Thanks.
>
> Em quarta-feira, 18 de setembro de 2013 11h38min14s UTC-3, Costin Leau escreveu:
>
>     I've pushed a fix for your issue in 0.90 and master:
>https://github.com/elasticsearch/elasticsearch/issues/3725
<https://github.com/elasticsearch/elasticsearch/issues/3725>
<https://github.com/elasticsearch/elasticsearch/issues/3725
<https://github.com/elasticsearch/elasticsearch/issues/3725>>
>
>     It would be great if you could test it out.
>
>     Thanks,
>
>     On 18/09/2013 3:57 PM, Mark Carpenter wrote:
>     > When trying to install Elasticsearch as a service using the provided batch script, it terminates without giving any
>     > console output. When double-clicked in Windows explorer, the command window appears and exits immediately. When run from
>     > a command window, nothing happens.
>     >
>     > Removing '@echo off' from service.bat and trying again yields the following:
>     >
>     >     C:\elasticsearch-0.90.5\bin>SETLOCAL
>     >     C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err
>     >     C:\elasticsearch-0.90.5\bin>set SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\
>     >     C:\elasticsearch-0.90.5\bin>for %I in ("C:\elasticsearch-0.90.5\bin\..") do set ES_HOME=%~dpfI
>     >     C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5
>     >     C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out appropriate executable to use
>     >     C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java -version   2>&1  | find "64-Bit"  1>nul:
>     >
>     > I am able to run elasticsearch.bat without any problem - I can index, search, and discover other nodes.
>     >
>     > Other useful info:
>     >
>     >   * Elasticsearch Version 0.90.5
>     >   * Windows Server 2012 Datacenter x64 (Hosted in Azure)
>     >   * JRE 1.7.0_40-b43
>     >
>     > Any ideas?
>     >
>     > --
>     > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
>     > To unsubscribe from this group and stop receiving emails from it, send an email to
>     >elasticsearc...@googlegroups.com <javascript:>.
>     > For more options, visithttps://groups.google.com/groups/opt_out <http://groups.google.com/groups/opt_out> <https://groups.google.com/groups/opt_out
<https://groups.google.com/groups/opt_out>>.
>
>     --
>     Costin
>
> --
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
>elasticsearc...@googlegroups.com <javascript:>.
> For more options, visithttps://groups.google.com/groups/opt_out <https://groups.google.com/groups/opt_out>.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Costin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Hendrik) #8

you also can try this

Am Mittwoch, 18. September 2013 14:57:36 UTC+2 schrieb Mark Carpenter:

When trying to install Elasticsearch as a service using the provided batch
script, it terminates without giving any console output. When
double-clicked in Windows explorer, the command window appears and exits
immediately. When run from a command window, nothing happens.

Removing '@echo off' from service.bat and trying again yields the
following:

C:\elasticsearch-0.90.5\bin>SETLOCAL
C:\elasticsearch-0.90.5\bin>if NOT DEFINED JAVA_HOME goto err
C:\elasticsearch-0.90.5\bin>set SCRIPT_DIR=C:\elasticsearch-0.90.5\bin\
C:\elasticsearch-0.90.5\bin>for %I in ("C:\elasticsearch-0.90.5\bin..")
do set ES_HOME=%~dpfI
C:\elasticsearch-0.90.5\bin>set ES_HOME=C:\elasticsearch-0.90.5
C:\elasticsearch-0.90.5\bin>rem Detect JVM version to figure out
appropriate executable to use
C:\elasticsearch-0.90.5\bin>C:\Program Files\Java\jre7\bin\java -version
2>&1 | find "64-Bit" 1>nul:

I am able to run elasticsearch.bat without any problem - I can index,
search, and discover other nodes.

Other useful info:

  • Elasticsearch Version 0.90.5
  • Windows Server 2012 Datacenter x64 (Hosted in Azure)
  • JRE 1.7.0_40-b43

Any ideas?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #9