`pipeline_shutdown_requested?` not found error with Logstash v7.17.x versions.
mashhurs opened this issue · 2 comments
Logstash information:
Please include the following information:
-
Logstash version (e.g.
bin/logstash --version
):7.17.10
-
Logstash installation source (e.g. built from source, with a package manager: DEB/RPM, expanded from tar or zip archive, docker)
Downloaded7.17.10
(Linux X86_64) from Logstash download page -
How is Logstash being run (e.g. as a service/service manager: systemd, upstart, etc. Via command line, docker/kubernetes)
Running via command line:./bin/logstash -f config/simple.conf
andsimple.conf
useses-output
. -
How was the Logstash Plugin installed
./bin/logstash-plugin install --version 11.15.4 logstash-output-elasticsearch
JVM (e.g.java -version
):
OS version (uname -a
if on a Unix-like system): Ubuntu 22.04
Description of the problem including expected versus actual behavior:
We introduced an expose shutdown to plugin
feature in v8.1.1
version and es-output
plugin started using this feature from its v11.15.0
versions. When running 11.15.0+ plugin versions with Logstash 7.17.x
versions, plugin crashes. Please look at the below error.
Steps to reproduce:
Please include a minimal but complete recreation of the problem,
including (e.g.) pipeline definition(s), settings, locale, etc. The easier
you make for us to reproduce it, the more likely that somebody will take the
time to look at it.
- Download Logstash
7.17.10
- Install
logstash-output-elasticsearch-v11.15.4
- Use simple config which uses Elastsearch output plugin and run Logstash with
./bin/logstash -f {your-config-path}
Provide logs (if relevant):
[2023-05-17T14:35:42,009][ERROR][logstash.javapipeline ][main] Pipeline worker error, the pipeline will be stopped
{:pipeline_id=>"main", :error=>"(NoMethodError) undefined method `shutdown_requested' for #
<LogStash::JavaPipeline:0x302ed65>", :exception=>Java::OrgJrubyExceptions::NoMethodError, :backtrace=>
["home.ubuntu.logstash_minus_7_dot_17_dot_10.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_output_minus_
elasticsearch_minus_11_dot_15_dot_4_minus_java.lib.logstash.plugin_mixins.elasticsearch.common.pipeline_shutdown_req
uested?(/home/ubuntu/logstash-7.17.10/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-11.15.4-
java/lib/logstash/plugin_mixins/elasticsearch/common.rb:380)",
"home.ubuntu.logstash_minus_7_dot_17_dot_10.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_output_minus_
elasticsearch_minus_11_dot_15_dot_4_minus_java.lib.logstash.outputs.elasticsearch.wait_for_successful_connection(/home
/ubuntu/logstash-7.17.10/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-11.15.4-
java/lib/logstash/outputs/elasticsearch.rb:435)",
"home.ubuntu.logstash_minus_7_dot_17_dot_10.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_output_minus_
elasticsearch_minus_11_dot_15_dot_4_minus_java.lib.logstash.outputs.elasticsearch.multi_receive(/home/ubuntu/logstash-
7.17.10/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-11.15.4-
java/lib/logstash/outputs/elasticsearch.rb:385)",
"org.logstash.config.ir.compiler.OutputStrategyExt$AbstractOutputStrategyExt.multi_receive(org/logstash/config/ir/compiler
/OutputStrategyExt.java:143)",
"org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multi_receive(org/logstash/config/ir/compiler/AbstractOutputDe
legatorExt.java:121)",
"home.ubuntu.logstash_minus_7_dot_17_dot_10.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/home/ubuntu
/logstash-7.17.10/logstash-core/lib/logstash/java_pipeline.rb:300)"], :thread=>"#<Thread:0x14bf827a sleep>"}
This issue is because the version that introduced wasn't meant to work in Logstash 7.17, and missed the required minimum dependency on logstash-core where this feature actually landed.
The error refers to https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/v11.15.4/lib/logstash/plugin_mixins/elasticsearch/common.rb#LL380C38-L380C56
def pipeline_shutdown_requested?
return super if defined?(super) # since LS 8.1.0
execution_context&.pipeline&.shutdown_requested
end
In LS < 8.1
the method pipeline_shutdown_requested?
doesn't exist so fallback to the implementation
execution_context&.pipeline&.shutdown_requested
but #shutdown_requested
doesn't exists in pipeline class, but shutdown_requested?
.
So adding the missed ?
should fix it.