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

fail to initialize the plugin with wrong number of arguments (given 1, expected 0) #204

Closed
kaisecheng opened this issue Dec 14, 2023 · 0 comments · Fixed by #205
Closed
Assignees
Labels

Comments

@kaisecheng
Copy link
Contributor

Since logstash upgrade ruby from 2.6 to 3.0, this plugin fails to initialize. According to update to JRuby 9.4, method clone need to rewrite to clone(*args)

The plugin has defined its clone, which overwrites the base class clone.
The codec class is wrapped by Delegator, hence fails to initialize with clone(freeze: ) here
I believe it is not desired to redefine the method.

Log

[2023-12-12T10:53:05,136][ERROR][logstash.javapipeline ][main][netflow] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Udp codec=><LogStash::Codecs::Netflow id=>"netflow_7a6737e7-8f36-4b23-8b18-5858e94d275b", enable_metric=>true, cache_ttl=>4000, target=>"netflow", include_flowset_id=>false, versions=>[5, 9, 10]>, id=>"netflow", port=>2055, tags=>["netflow"], enable_metric=>true, host=>"0.0.0.0", buffer_size=>65536, workers=>2, queue_size=>2000>
Error: wrong number of arguments (given 1, expected 0)
Exception: ArgumentError
Stack: /usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-codec-netflow-4.3.0/lib/logstash/codecs/netflow.rb:60:in `clone'
/usr/share/logstash/vendor/jruby/lib/ruby/stdlib/delegate.rb:226:in `initialize_clone'
org/jruby/RubyKernel.java:2187:in `clone'
/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-input-udp-3.5.0/lib/logstash/inputs/udp.rb:76:in `block in run'
org/jruby/RubyArray.java:2809:in `map'
/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-input-udp-3.5.0/lib/logstash/inputs/udp.rb:74:in `run'
/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:414:in `inputworker'
/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:405:in `block in start_input'

Relates: elastic/logstash#14861

@kaisecheng kaisecheng added the bug label Dec 14, 2023
@kaisecheng kaisecheng self-assigned this Dec 14, 2023
kaisecheng added a commit to kaisecheng/logstash-codec-netflow that referenced this issue Dec 14, 2023
to fix ArgumentError wrong number of arguments (given 1, expected 0)
in initialization to fit jruby 9.3.4.0 ruby 3.1

Fix: logstash-plugins#204
kaisecheng added a commit to kaisecheng/logstash-codec-netflow that referenced this issue Dec 14, 2023
to fix ArgumentError wrong number of arguments (given 1, expected 0)
in initialization to be compatible with jruby 9.4

Fix: logstash-plugins#204
kaisecheng added a commit to kaisecheng/logstash-codec-netflow that referenced this issue Dec 14, 2023
to fix ArgumentError wrong number of arguments (given 1, expected 0)
in initialization to be compatible with jruby 9.4

Fix: logstash-plugins#204
kaisecheng added a commit that referenced this issue Dec 14, 2023
This commit updated the clone method signature to be compatible with jruby 9.4

Fix: #204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant