Logstash / Filewatch double initialization

I contributed to filewatch in the past, and was retesting Logstash 2.2.0 to see that the bug fixes were really working properly since they were integrated differently than I originally intended.

So, the question.
I am using input files (filewatch) and noticed that tail_base.rb Initialize method is being called 2 times with just 1 file in my config. The first time through it passes opts (arguments from tail_config) that are empty. The 2nd time through they are correct. The issue is, when they are empty, tail_base.rb raises an exception because there is no sincedb_path config parameter.

The way around this is to setup a SINCEDB_PATH environment variable, but this is just a workaround.

I am not yet able to understand why this code is being called twice and the first time through there are no configuration parameters. I am not yet saying this is a bug. Maybe it is something I am not understanding. If anyone could shed some light, that would be very helpful.

If you want to know the stack traces of the two passes they are

first pass in tail_base.rb initialize when only using one input file.

pipeline.rb 310 in start_input
pipeline.rb 316 in input_worker
file.rb 288 in run
file.rb 282 in begin_tailing
tail.rb 14 new_observing
tail.rb 20 in initialize

2nd pass

pipeline.rb 310 in start_input
pipeline.rb 316 in input_worker
file.rb 288 in run
file.rb 282 in begin_tailing
tail.rb 14 new_observing
rail.rb 14 tap
tail.rb 15 in new_observing

Thanks,

Close this item. I have figured it out.