Navigation Menu

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

windows as service does not work #13247

Closed
rmuir opened this issue Sep 1, 2015 · 7 comments
Closed

windows as service does not work #13247

rmuir opened this issue Sep 1, 2015 · 7 comments
Assignees
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v2.0.0-beta2

Comments

@rmuir
Copy link
Contributor

rmuir commented Sep 1, 2015

Trying to follow https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-service-win.html doesn't work with master.

I get this error "The data area passed to a system call is too small"

@rmuir rmuir added the >bug label Sep 1, 2015
@rmuir
Copy link
Contributor Author

rmuir commented Sep 1, 2015

I think this functionality is also untested.

@clintongormley clintongormley added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts v2.0.0 labels Sep 1, 2015
@clintongormley
Copy link

@gmarz would you be able to take a look at this?

@gmarz
Copy link
Contributor

gmarz commented Sep 1, 2015

I get the same thing as well:

Exception in thread "main" areSettings(InternalSettingsPreparer.java:87)
    at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:108)
    at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:101)
    at org.elasticsearch.bootstrap.BootstrapCLIParser.<init>(BootstrapCLIParser.java:48)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:226)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:28)
The data area passed to a system call is too small.

Failed to start service

I'll start digging...

@nik9000
Copy link
Member

nik9000 commented Sep 1, 2015

I think this functionality is also untested.

Very much. I was looking at getting vagrant tests for this too but it'd be very different than the existing bats tests. And I'm not sure what the licenses are for running windows VMs for testing. If someone can point me to something that makes it clear that window's license lets people spin up VMs for testing then I'll dig more into it and try to use the same technique we use for linux. Without bash, I guess.

@jochen-st
Copy link

I found that changes in elasticsarch.in.bat related to ES_GC_OPTS environment variables caused JAVA_OPTS environment variable to contain " " two consecutive spaces. These are converted by service.bat into ";;" two consecutive semicolons. This causes procrun to stop adding Java options to service and service start fails with:

Java HotSpot(TM) 64-Bit Server VM warning: Using the ParNew young collector with the Serial old 
collector is deprecated and will likely be removed in a future release
Exception in thread "main" areSettings(InternalSettingsPreparer.java:97)
at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:107)
at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:100)
at org.elasticsearch.bootstrap.BootstrapCLIParser.<init>(BootstrapCLIParser.java:48)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:221)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

However even after manipulating ES_GC_OPTS / JAVA_OPTS to not contain two consecutive spaces (and procrun taking all Java options), service start still fails with

ERROR: command not specified

I found that this can be fixed by adding "--StartParams start" to service.bat line 162 (starts with "%EXECUTABLE%" //IS//%SERVICE_ID%)

Now stopping fails with

Method 'static void close(String[])' not found in Class org/elasticsearch/bootstrap/Elasticsearch

@gmarz
Copy link
Contributor

gmarz commented Sep 8, 2015

@jochen-st yea, that's one of the issues with the script. The other, which you're running into now has to do with the fact that the new elasticsearch CLI now requires a start argument, which the service doesn't pass.

I'm working on a fix and will open a PR shortly.

@gmarz
Copy link
Contributor

gmarz commented Sep 8, 2015

@jochen-st sorry, just realized I misread your comment and that you already discovered that the script doesn't pass the start param. I just opened the above PR to address the startup issues.

The stopping issue is a bit more involved. Apache Commons Daemon requires a static stop method (--StopMethod) in order to shutdown gracefully. This use to exist (org.elasticsearch.bootstrap.Elasticsearch.close()) but was removed in ES 2.x. The script was never updated, hence the error message.

Not sure the reasoning for removing it and how it should be added back. I'm going to open a new issue for this.

gmarz added a commit to gmarz/elasticsearch that referenced this issue Sep 9, 2015
This commit addresses several bugs that prevented the Windows
service from being started or stopped:

- Extra white space in the concatenation of java options in
  elasticsearch.in.bat which tripped up Apache Commons Daemon
  and caused ES to startup without any params, eventually leading
  to the "path.home is not configured" exception.

- service.bat was not passing the start argument to ES

- The service could not be stopped gracefully via the stop command
  because there wasn't a method for procrun to call.

Closes elastic#13247
Closes elastic#13401
gmarz added a commit that referenced this issue Sep 9, 2015
This commit addresses several bugs that prevented the Windows
service from being started or stopped:

- Extra white space in the concatenation of java options in
  elasticsearch.in.bat which tripped up Apache Commons Daemon
  and caused ES to startup without any params, eventually leading
  to the "path.home is not configured" exception.

- service.bat was not passing the start argument to ES

- The service could not be stopped gracefully via the stop command
  because there wasn't a method for procrun to call.

Closes #13247
Closes #13401
@gmarz gmarz closed this as completed in 9e6115b Sep 9, 2015
gmarz added a commit that referenced this issue Sep 9, 2015
This commit addresses several bugs that prevented the Windows
service from being started or stopped:

- Extra white space in the concatenation of java options in
  elasticsearch.in.bat which tripped up Apache Commons Daemon
  and caused ES to startup without any params, eventually leading
  to the "path.home is not configured" exception.

- service.bat was not passing the start argument to ES

- The service could not be stopped gracefully via the stop command
  because there wasn't a method for procrun to call.

Closes #13247
Closes #13401
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v2.0.0-beta2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants