elastic/logstash

In some situations bin/logstash-plugins can fail to run

Open

#13,698 opened on Feb 1, 2022

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Ruby (14,197 stars) (3,496 forks)batch import
buggood first issueplugin managerstatus:needs-info

Description

Logstash information:

Please include the following information:

  1. Logstash version: 7.16.3 (with unverified reports of similar behaviour on 7.15)

    Looking through our case history there were examples of this issue happening after upgrading to 7.15 and higher. The odd behavior is this appears to be intermittent in most cases, and the cases closed out without resolution. Confirmed that for this customer they only had it happen on two of their machines, and its very consistent on those. Also confirmed that Logstash does upgrade and is able to function normally.

  2. Logstash installation source: DEB
  3. How is Logstash being run: Issue centers on command-line tool bin/logstash-plugin

Plugins installed: (bin/logstash-plugin list --verbose): default set

JVM (e.g. java -version):

If the affected version of Logstash is 7.9 (or earlier), or if it is NOT using the bundled JDK or using the 'no-jdk' version in 7.10 (or higher), please provide the following information:

  1. JVM version (java -version) 11.x
  2. JVM installation source: bundled JDK
  3. Value of the LS_JAVA_HOME environment variable if set. N/A

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

Description of the problem including expected versus actual behavior:

When invoking the bin/logstash-plugin list --installed command from a path that is not the Logstash installation, the command fails to run with opaque error messages about failing to load bundler.

REDACTED_USER@REDACTED_HOST:REDACTED_PATH$ sudo /usr/share/logstash/bin/logstash-plugin list --installed
Using bundled JDK: /usr/share/logstash/jdk
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
LoadError: no such file to load -- bundler
require at org/jruby/RubyKernel.java:974
require at /usr/share/logstash/vendor/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:83
<main> at /usr/share/logstash/lib/pluginmanager/bundler/logstash_injector.rb:19
require at org/jruby/RubyKernel.java:974

Where REDACTED_PATH is a subdirectory of /var/local and therefore shares nothing with /usr/share installation path of Logstash. Note that as-reported, the command was being run as the super user with sudo.

Steps to reproduce:

Support attempted to reproduce it with RPM, and YUM, but was not able to

Similarly, I have not personally been able to reproduce. If you have repeatable reproduction steps, we ask that you provide them in the comments. Please include directory permissions for the Logstash installation as these may be a contributing factor.

Workaround

Eventually the customer appears to have resolved this by changing the working directory for running their config management tasks [...]

The provided workaround is to first change the current working directory to the logstash installation's bin directory:

cd /usr/share/logstash/bin
./logstash-plugin list --installed

Contributor guide