diff options
author | Eric Wong <e@80x24.org> | 2024-04-26 07:04:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-05-07 08:52:59 +0000 |
commit | b7e6406f79a1b27e50997e02ef6985ae0a33b14b (patch) | |
tree | e1cf505863f0eca68643ab37683aacc2b90cbe78 | |
parent | 1deaad83499ad73df20a64a6a859c2d0dded1e0f (diff) | |
download | dtas-b7e6406f79a1b27e50997e02ef6985ae0a33b14b.tar.gz |
soxi or ffprobe may infinite loop on bad files, so be sure to let these processes timeout properly.
-rwxr-xr-x | bin/dtas-readahead | 2 | ||||
-rw-r--r-- | lib/dtas/source/av_ff_common.rb | 2 | ||||
-rw-r--r-- | lib/dtas/source/sox.rb | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/bin/dtas-readahead b/bin/dtas-readahead index f2ab514..c61d317 100755 --- a/bin/dtas-readahead +++ b/bin/dtas-readahead @@ -25,7 +25,7 @@ w.req_ok('watch') c = DTAS::UNIXClient.new @max_ra = 30 * 1024 * 1024 null = DTAS.null -@redir = { err: null, out: null, in: null }.freeze +@redir = { err: null, out: null, in: null, rlimit_cpu: [ 1, 2 ] }.freeze require 'pp' def seek_to_cur_pos(cur_pid, fp) diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb index c600c48..7f197e0 100644 --- a/lib/dtas/source/av_ff_common.rb +++ b/lib/dtas/source/av_ff_common.rb @@ -92,7 +92,7 @@ module DTAS::Source::AvFfCommon # :nodoc: err = "".b begin - s = qx(@env, cmd, err_str: err, no_raise: true) + s = qx(@env, cmd, err_str: err, no_raise: true, rlimit_cpu: [ 1, 2 ]) rescue Errno::ENOENT # avprobe/ffprobe not installed return false end diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb index c03477e..365c7b6 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -39,7 +39,8 @@ class DTAS::Source::Sox # :nodoc: def mcache_lookup(infile) (@mcache ||= DTAS::Mcache.new).lookup(infile) do |input, dst| err = ''.b - out = qx(@env.dup, %W(soxi #{input}), err_str: err, no_raise: true) + out = qx(@env.dup, %W(soxi #{input}), err_str: err, no_raise: true, + rlimit_cpu: [ 1, 2 ]) return soxi_failed(infile, out) if Process::Status === out return soxi_failed(infile, err) if err =~ /soxi FAIL formats:/ out =~ /^Duration\s*:[^=]*= (\d+) samples /n |