TCP unit test is failing more often than not


I have two problems running the latest (as of the filing date of the bug) at the master branch and also 1.3.2 .

1) bin/logstash rspec --format d spec/inputs/tcp.rb is not running a deterministic number of tests for me. Sometimes it runs 1 test, sometimes all 4. Sometimes they all pass, most of the time not.

2) I can't for the life of me figure out how to enable debug level logging so I can see the pipelines running. I could have sworn that setting the environment variable LOGSTASH_DEBUG to 1 would do the trick, but no such luck.

If someone lets me know what do to about #2, I might be able to attack #1 myself.

I was in the process of adding a unit test for the "json_lines" codec for tcp.rb when I noticed that the base unit test was problematic.

I get the same unreliable behavior on both "OS X Mavericks" and "Ubuntu 12.04.3".

PS: I also am seeing these errors on my production servers when I run with the --debug switch, which accounts for a large % of lost messages.


Luis F. Ortiz
February 6, 2014, 2:22 PM

The magic variable for turning on debugging during spec test execution is: TEST_DEBUG

I now have a set of fixes for the TCP input, but one of the unit tests does not pass, and I don't think it has been passing for a bit (the one that does the funny character set conversions).

I'll generate a pull request when I have baked the changes in my deployment for a few days.

The root causes of the problems were:
1) The closing of a TCP connection is NOT an error, it is a normal condition which should not cause panic.
2) The shutdown of tcp input should not cause the shutdown of logstash, or more than one test will not run reliably!

Luis F. Ortiz
March 14, 2014, 4:29 PM

At ef5af788938eadc3d9582704327976e9b0968f69, this is the failure:

Luis F. Ortiz
March 14, 2014, 4:35 PM

Post fix:

Luis F. Ortiz
March 19, 2014, 12:50 PM


Luis F. Ortiz


Luis F. Ortiz


Fix versions

Affects versions