analytics-kafkatee icon indicating copy to clipboard operation
analytics-kafkatee copied to clipboard

No new pipe input means kafkatee will not shutdown properly on SIGTERM

Open ottomata opened this issue 11 years ago • 1 comments

If there is no new input on a configured piped input, kafkatee will hang on an fgets() call in input.c This causes kafkatee to not clean up children and pidfile properly.

We should probably use select() with a timeout instead of fgets() to poll for new data to read. I just had a quick look at implementing this, but since the code in input_pipe_main() uses FILE * instead of fds for all of its error checking, it requires more than just modification of the while loop for reading.

I suppose this would be difficult, because select() might indicate that there is data ready to be read before a full line has been written to the piped input?

ottomata avatar Feb 18 '14 22:02 ottomata

This is not easily fixable due to the nature of fgets(). The proper fix is probably to implement line buffering using the lower IO calls, but thats a bit of work and "input pipe" is mainly used for testing, right?

A workaround would be to kill any non-terminating input pipe threads after a grace time - this would lead to resource loss (valgrind would complain) but we're exiting anyway so not a real issue.

edenhill avatar Feb 19 '14 02:02 edenhill