UDP Input plugin Error: TypeError: can't convert nil into String

Once we start sending 200 more messages to UPD input during perf testing, I start seeing below errors and packets get lost.

[2017-12-06T18:46:04,519][ERROR][l.i.udp ] Exception in inputworker {"exception"=>#<TypeError: can't convert nil into String>, "backtrace"=>["org/jruby/RubyArray.java:1892:in join'", "org/jruby/RubyArray.java:1898:injoin'", "/opt/logstash/logstash-core/lib/logstash/util/buftok.rb:87:in extract'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-line-3.0.2/lib/logstash/codecs/line.rb:39:indecode'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:118:in inputworker'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:89:inudp_listener'"]}

config
udp {
port => 514
codec => line
workers => 8
queue_size => 8000
}

1 Like

found some similar issue at earlier version.

"my hypothesis above is not correct and there is something else going on because BufferedTokenizer does not accept nil payload but it does end up with an object in its @input array that provoke this TypeError: can't convert nil into String when doing an Array#join. investigating..."

Any progress?

Also, we are seeing messages get mangled sometimes.

Thanks for the heads up @akirafei.

Do you have a way to reproduce this problem systematically? Looking at the history of this issue, the problem we had was that we could not reproduce it.

The only information you provided is :

Once we start sending 200 more messages to UPD input during perf testing

If we could come up with a simple way to reproduce this using netcat, some test data and a minimal config would be really helpful.
Colin

Ok, I gave it a spin and in fact I can reproduce quite easily and I am pretty sure I know where the problem is. Followup in the issue https://github.com/logstash-plugins/logstash-input-udp/issues/4

@akirafei this is a thread safety issue and until a fix is pushed, what you can do is to use a single udp input worker.

udp {
  port => 514
  codec => line
  workers => 1
  queue_size => 8000
}
1 Like

This problem is now solved, the problem was with a thread safety issue in the line codec. A new line codec plugin version 3.0.6 has been released. You can update using:

bin/logstash-plugin update logstash-codec-line
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.