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

java.lang.StackOverflowError when codec does not have an encode method #13443

Open
TheVastyDeep opened this issue Nov 23, 2021 · 3 comments
Open
Labels
bug plugin issue issue related to a plugin

Comments

@TheVastyDeep
Copy link

logstash 7.15.2, installed using yum, run from the command line. The following configuration

input { generator { count => 1 lines => [ '' ] } }
output { udp { port  => 2055 codec => netflow host => "127.1.2.3" } }

results in

warning: thread "[main]>worker0" terminated with exception (report_on_exception is true):
java.lang.StackOverflowError
    at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.base.encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/base.rb:48)
    at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.base.multi_encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/base.rb:64)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1820)
    at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.base.multi_encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/base.rb:64)
    at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.base.encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/base.rb:48)
    at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.base.multi_encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/base.rb:64)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1820)

because in codec/base.rb encode calls multi_encode, which calls encode.

Personally I think the netflow codec should be modified to add an encode method which throws an exception saying "You cannot use this codec on an output".

@kares
Copy link
Contributor

kares commented Dec 1, 2021

Thanks for the report, indeed the base class assumed the codec to override multi_encode or encode.

Personally I think the netflow codec should be modified to add an encode method which throws an exception saying "You cannot use this codec on an output".

Yes, this would be the best approach, (e.g. a different codec not supporting decode raises).

It might be better to have the issue report at https://github.com/logstash-plugins/logstash-codec-netflow/issues so someone looking at the codec is aware of it.

@TheVastyDeep
Copy link
Author

I have opened 196 against the netflow codec, so if the override is a requirement of the base filter this can be closed.

@kares
Copy link
Contributor

kares commented Dec 2, 2021

yes due how codecs are handling either to re-def encode or multi_encode the base.rb isn't going to change anytime soon.

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

No branches or pull requests

2 participants