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.
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 IO.select with a timeout. But that might impact performance.
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.
Sorry about the bug!
commit a9bb8689e28b094258d48480c60b1eda5911c979 fixes this bug
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.
suggest Reopening.. I'm seeing same in logstash-1.4.1 with jdk-1.7.0_25-x86_64.