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

**URL:** <https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565>\
**Category:** Logstash\
**Created:** [December 6, 2017, 7:04pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565 "2017-12-06T19:04:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![akirafei](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@akirafei](https://discuss.elastic.co/u/akirafei)\
**Post date:** [December 6, 2017, 7:04pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/1 "2017-12-06T19:04:00Z")

</div>

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:in`join'", "/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:in`decode'", "/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:in`udp\_listener'"]}

config  
udp {  
port =\> 514  
codec =\> line  
workers =\> 8  
queue\_size =\> 8000  
}

---

<div class="post-metadata">

**Author:** ![akirafei](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@akirafei](https://discuss.elastic.co/u/akirafei)\
**Post date:** [December 6, 2017, 7:16pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/2 "2017-12-06T19:16:56Z")

</div>

found some similar issue at earlier version.

> <https://github.com/logstash-plugins/logstash-input-udp/issues/4>

"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?

---

<div class="post-metadata">

**Author:** ![akirafei](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@akirafei](https://discuss.elastic.co/u/akirafei)\
**Post date:** [December 6, 2017, 8:10pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/3 "2017-12-06T20:10:54Z")

</div>

Also, we are seeing messages get mangled sometimes.

---

<div class="post-metadata">

**Author:** ![colinsurprenant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colinsurprenant/32/14776_2.png) [@colinsurprenant](https://discuss.elastic.co/u/colinsurprenant)\
**Post date:** [December 11, 2017, 6:14pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/4 "2017-12-11T18:14:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![colinsurprenant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colinsurprenant/32/14776_2.png) [@colinsurprenant](https://discuss.elastic.co/u/colinsurprenant)\
**Post date:** [December 11, 2017, 9:20pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/5 "2017-12-11T21:20:49Z")

</div>

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](https://github.com/logstash-plugins/logstash-input-udp/issues/4)

---

<div class="post-metadata">

**Author:** ![colinsurprenant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colinsurprenant/32/14776_2.png) [@colinsurprenant](https://discuss.elastic.co/u/colinsurprenant)\
**Post date:** [December 11, 2017, 9:56pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/6 "2017-12-11T21:56:27Z")

</div>

@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.

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

```

---

<div class="post-metadata">

**Author:** ![colinsurprenant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colinsurprenant/32/14776_2.png) [@colinsurprenant](https://discuss.elastic.co/u/colinsurprenant)\
**Post date:** [December 12, 2017, 7:52pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/7 "2017-12-12T19:52:45Z")

</div>

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:

```auto
bin/logstash-plugin update logstash-codec-line

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 9, 2018, 7:53pm UTC](https://discuss.elastic.co/t/udp-input-plugin-error-typeerror-cant-convert-nil-into-string/110565/8 "2018-01-09T19:53:00Z")

</div>

Closed on January 9, 2018, 7:53pm UTC

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