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

bin\logstash-plugin does not work on windows in 8.3.2 #14354

Closed
robbavey opened this issue Jul 14, 2022 · 8 comments
Closed

bin\logstash-plugin does not work on windows in 8.3.2 #14354

robbavey opened this issue Jul 14, 2022 · 8 comments
Labels

Comments

@robbavey
Copy link
Member

robbavey commented Jul 14, 2022

Logstash information:

Please include the following information:

  1. Logstash version (e.g. bin/logstash --version)
    8.3.2
  2. Logstash installation source (e.g. built from source, with a package manager: DEB/RPM, expanded from tar or zip archive, docker)
    Downloaded from elastic.co
  3. How is Logstash being run (e.g. as a service/service manager: systemd, upstart, etc. Via command line, docker/kubernetes)
    via command line on windows

JVM (e.g. java -version):
Bundled JDK

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

Microsoft Windows [Version 10.0.14393]

Description of the problem including expected versus actual behavior:
When running bin\logstash-plugin list the following error is output:

C:\logstash-8.3.2>bin\logstash-plugin list
"Using bundled JDK: C:\logstash-8.3.2\jdk\bin\java.exe"
Errno::EACCES: Permission denied - NUL
                    sysopen at org/jruby/RubyIO.java:1237
                 initialize at org/jruby/RubyFile.java:365
                       open at org/jruby/RubyIO.java:1156

This is related to #14042, but the fix to add this to the list of mandatory command-line options is not honoured, as the Windows scripts for tools, such as the plugin manager, and the keystore do not use jvm.options or the JvmOptionsParser, meaning that the -Djdk.io.file.enableADS=true option is bypassed, leading to logstash encountering the bug first identified in #14042

A workaround exists - calling set JRUBY_OPTS=-J-Djdk.io.file.enableADS=true will instruct the jruby instance invoked by the plugin script to set the required system property enabling the plugin manager to run correctly

robbavey added a commit to robbavey/logstash that referenced this issue Jul 14, 2022
Prior to this commit, the windows version of the keystore and plugin scripts
diverged from the bash version of these scripts, as they did not pick up Jvm Options
from the JvmOptionsParser, leading to certain mandatory settings not being picked up,
breaking compatibility with Windows on certain versions of the JDK. This PR ensures
that these scripts also use the JvmOptionsParser.

This does not resolve the issue described in elastic#14176, which will be looked at in a future
PR

Relates: elastic#14354
robbavey added a commit that referenced this issue Jul 18, 2022
* Fix windows scripts to also pull settings from JvmOptionsParser

Prior to this commit, the windows version of the keystore and plugin scripts
diverged from the bash version of these scripts, as they did not pick up Jvm Options
from the JvmOptionsParser, leading to certain mandatory settings not being picked up,
breaking compatibility with Windows on certain versions of the JDK. This PR ensures
that these scripts also use the JvmOptionsParser.

This does not resolve the issue described in #14176, which will be looked at in a future
PR

Relates: #14354

* Add goto :eof as per code review suggestion
github-actions bot pushed a commit that referenced this issue Jul 18, 2022
* Fix windows scripts to also pull settings from JvmOptionsParser

Prior to this commit, the windows version of the keystore and plugin scripts
diverged from the bash version of these scripts, as they did not pick up Jvm Options
from the JvmOptionsParser, leading to certain mandatory settings not being picked up,
breaking compatibility with Windows on certain versions of the JDK. This PR ensures
that these scripts also use the JvmOptionsParser.

This does not resolve the issue described in #14176, which will be looked at in a future
PR

Relates: #14354

* Add goto :eof as per code review suggestion

(cherry picked from commit 59c5374)
@robbavey
Copy link
Member Author

Closed by #14355

robbavey added a commit that referenced this issue Jul 18, 2022
…) (#14356)

* Fix windows scripts to also pull settings from JvmOptionsParser

Prior to this commit, the windows version of the keystore and plugin scripts
diverged from the bash version of these scripts, as they did not pick up Jvm Options
from the JvmOptionsParser, leading to certain mandatory settings not being picked up,
breaking compatibility with Windows on certain versions of the JDK. This PR ensures
that these scripts also use the JvmOptionsParser.

This does not resolve the issue described in #14176, which will be looked at in a future
PR

Relates: #14354

* Add goto :eof as per code review suggestion

(cherry picked from commit 59c5374)

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
@yeskela
Copy link

yeskela commented Jul 19, 2022

I have this issue... what should I do to fix it?

@robbavey
Copy link
Member Author

robbavey commented Jul 19, 2022

A workaround exists - calling set JRUBY_OPTS=-J-Djdk.io.file.enableADS=true will instruct the jruby instance invoked by the plugin script to set the required system property enabling the plugin manager to run correctly

@yeskela
Copy link

yeskela commented Jul 19, 2022

set the JRUBY_OPTS as provided above... didn't help...

PS C:\Dev\logstash-8.3.2> .\bin\logstash-plugin list
"Using bundled JDK: C:\Dev\logstash-8.3.2\jdk\bin\java.exe"
Unrecognized option: -Fjdk.io.file.enableADS=true
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

@robbavey
Copy link
Member Author

Apologies there is a typo in there - it should read:

set JRUBY_OPTS=-J-Djdk.io.file.enableADS=true

@yeskela
Copy link

yeskela commented Jul 19, 2022

thanks but still doesn't work :(

PS C:\Dev\logstash-8.3.2> .\bin\logstash-plugin list
"Using bundled JDK: C:\Dev\logstash-8.3.2\jdk\bin\java.exe"
Errno::EACCES: Permission denied - NUL
                    sysopen at org/jruby/RubyIO.java:1237
                 initialize at org/jruby/RubyFile.java:365
                       open at org/jruby/RubyIO.java:1156
                 initialize at C:/Dev/logstash-8.3.2/vendor/jruby/lib/ruby/stdlib/rubygems/user_interaction.rb:645
                 initialize at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/ui/rg_proxy.rb:11
                        ui= at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler.rb:91
                         ui at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler.rb:87
                   validate at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/rubygems_integration.rb:68
              validate_spec at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/source/path.rb:168
            load_spec_files at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/source/path.rb:182
                       each at org/jruby/RubyArray.java:1821
            load_spec_files at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/source/path.rb:176
                local_specs at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/source/path.rb:107
                      specs at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/source/path.rb:115
  specs_for_source_changed? at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/definition.rb:562
             specs_changed? at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/definition.rb:547
             converge_paths at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/definition.rb:591
                       any? at org/jruby/RubyArray.java:4553
             converge_paths at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/definition.rb:590
                 initialize at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/definition.rb:134
              to_definition at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/dsl.rb:219
                   evaluate at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/dsl.rb:13
                      build at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler/definition.rb:38
                 definition at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler.rb:208
                      setup at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/bundler-2.3.17/lib/bundler.rb:156
                     setup! at C:/Dev/logstash-8.3.2/lib/bootstrap/bundler.rb:83
                    execute at C:/Dev/logstash-8.3.2/lib/pluginmanager/list.rb:33
                        run at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/clamp-1.0.1/lib/clamp/command.rb:68
                    execute at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/clamp-1.0.1/lib/clamp/subcommand/execution.rb:11
                        run at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/clamp-1.0.1/lib/clamp/command.rb:68
                        run at C:/Dev/logstash-8.3.2/vendor/bundle/jruby/2.5.0/gems/clamp-1.0.1/lib/clamp/command.rb:133
                     <main> at C:\Dev\logstash-8.3.2\lib\pluginmanager\main.rb:64

I'm running it on Windows 10 Pro with Java

PS C:\Dev\logstash-8.3.2> java --version
java 18.0.1.1 2022-04-22
Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)

@robbavey
Copy link
Member Author

@yeskela Apologies again - while we have committed a fix for this for a future version of logstash, this version will require some editing of the batch file to get this working:

Open bin/logstash-plugin.bat and replace the line

%JRUBY_BIN% "%LS_HOME%\lib\pluginmanager\main.rb" %*

with:

%JRUBY_BIN% "-J-Djdk.io.File.enableADS=true" "%LS_HOME%\lib\pluginmanager\main.rb" %*

@yeskela
Copy link

yeskela commented Jul 19, 2022

great! thanks you so much, @robbavey! It works now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants