We use a separate process to create video thumbnails because gstreamer instability. Each process is given an fd to the open video file, uses gstreamer to extract a thumbnail, and then exists.
Every now and then, gstreamer hangs. To deal with that, we have a 10-second timer that fires if the process doesn't terminate. When the timer fires, we send a SIGKILL.
The problem is that the process doesn't not terminate in response to SIGKILL or, rather, waitpid() doesn't complete after sending the signal.
I used timestamps on the relevant calls. When the timer fires, we send SIGKILL (via kill(2)) and then immediately call waitpid(). The kill() call returns immediately, but waitpid() hangs for between 30 and 40 seconds. Then waitpid completes. In the mean time, the gstreamer process is shown as a zombie in the proc table.
The problem is ultimately caused by gstreamer.
We use a separate process to create video thumbnails because gstreamer instability. Each process is given an fd to the open video file, uses gstreamer to extract a thumbnail, and then exists.
Every now and then, gstreamer hangs. To deal with that, we have a 10-second timer that fires if the process doesn't terminate. When the timer fires, we send a SIGKILL.
The problem is that the process doesn't not terminate in response to SIGKILL or, rather, waitpid() doesn't complete after sending the signal.
I used timestamps on the relevant calls. When the timer fires, we send SIGKILL (via kill(2)) and then immediately call waitpid(). The kill() call returns immediately, but waitpid() hangs for between 30 and 40 seconds. Then waitpid completes. In the mean time, the gstreamer process is shown as a zombie in the proc table.