shaka-project / shaka-streamer

A simple config-file based approach to preparing streaming media, based on FFmpeg and Shaka Packager.
https://shaka-project.github.io/shaka-streamer/
Apache License 2.0
198 stars 62 forks source link

Killing an ffmpeg process kills Streamer #20

Closed joeyparrish closed 5 years ago

joeyparrish commented 5 years ago

Killing an ffmpeg process currently kills Streamer instead of shutting down cleanly.

./shaka_streamer.py -i config_files/input_looped_file_config.yaml -p config_files/pipeline_live_config.yaml

Then pick an ffmpeg process from ps in Linux and kill it by PID.

The controller should see that a process died and shut down the pipeline by killing the others.

Instead, it dies and orphans the other subprocesses.

TheModMaker commented 5 years ago

It looks like our assumptions of child processes was wrong. When we spawn a child process, that process doesn't get closed when we exit. If we want to kill the subprocesses, we need to explicitly kill them when we shut down. Otherwise the process will get orphaned and remain running.

Also note that currently, the killing isn't detected as an error and the streamer returns success. We are ignoring the return codes from the long-running processes and just stopping when one of the exits.