I've discovered a race condition while using UDP input with json_lines codec. I tested using the latest logstash docker image.
Logstash config:
input {
udp {
port => 13371
codec => json_lines
}
}
test script (python)
from socket import *
a=socket(AF_INET, SOCK_DGRAM)
while True:
a.sendto('{"foo": "bar"}\n', ('localhost', 13371))
This consistently produces the following error:
21:46:51.401 [<udp.0] ERROR logstash.inputs.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:in `join'", "/usr/share/logstash/logstash-core/lib/logstash/util/buftok.rb:87:in `extract'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-json_lines-3.0.2/lib/logstash/codecs/json_lines.rb:40:in `decode'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:118:in `inputworker'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:89:in `udp_listener'"]}
If I add an output, the error never occurs
output {
stdout {
codec => rubydebug
}
}
If I add a sleep(.1) to the python script, it also does not throw the exception.