samvera-labs / active_encode

Declare encode job classes that can be run by a variety of encoding services
Other
6 stars 8 forks source link

Handle case when pid file is never created #117

Open cjcolvar opened 1 year ago

cjcolvar commented 1 year ago

If processing fails during mediainfo file inspection a pid file is never created. When get_pid returns nil it gets converted to 0 by the call to to_i in running? which will always be true. So the encode will never appear as completed.

https://github.com/samvera-labs/active_encode/blob/3cac5a2d69e873313a83656562f0c21efb09c394/lib/active_encode/engine_adapters/ffmpeg_adapter.rb#L244-L249

I found this with an encode in production and worked around the issue by creating a pid file with -1 as its contents.