Can't stop Logstash with a UDP input


Simple config:

If I try and run Logstash from a terminal and then Ctrl+C it:

Logstash won't exit. If I change from UDP to TCP, it quits fine.


Bernd Ahlers
September 15, 2013, 4:11 PM

I think this is due to the custom signal handler for SIGINT that gets installed by logstash.

The custom handler prevents the interrupt delivery to the recvfrom call and so recvfrom blocks and the shutdown does not get executed. If you send an UDP message to the input after you have pressed ctrl+c, logstash does a proper shutdown because the new UDP message unblocks the output thread and the LogStash::ShutdownSignal exception gets raised.

I'm not sure if there is a way to unblock recvfrom with a custom signal handler. One way to work around it is to use recvfrom_nonblock and with a timeout. But that might impact performance.

Bernd Ahlers
September 15, 2013, 4:21 PM

Similar issue with Leif's configuration. Here the stdin input blocks on sysread.

See comment from the stdin input:

Here logstash shuts down if you press ctrl+d before or after pressing crtl+c.

Jordan Sissel
September 16, 2013, 5:56 AM

Sorry about the bug!

commit a9bb8689e28b094258d48480c60b1eda5911c979 fixes this bug

Bernd Ahlers
September 16, 2013, 9:13 AM

Ah, you just close the socket from the pipeline thread.

It works fine with an udp input.

But breaks with a tcp input. Logstash stops but throws and exception.

edward wagner
May 9, 2014, 12:48 AM

suggest Reopening.. I'm seeing same in logstash-1.4.1 with jdk-1.7.0_25-x86_64.



Jordan Sissel


Matt Dainty



Fix versions

Affects versions