From 1dbc71ce041c451a9f273c2bb1a02aff03f87e1b Mon Sep 17 00:00:00 2001 From: bajankristof Date: Tue, 18 Jun 2024 22:09:04 +0200 Subject: [PATCH 1/2] fix: replace recursion with while loop in FFMPEG::Timeout to avoid SystemStackError --- lib/ffmpeg/timeout.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/ffmpeg/timeout.rb b/lib/ffmpeg/timeout.rb index 8c8205c..65d9182 100644 --- a/lib/ffmpeg/timeout.rb +++ b/lib/ffmpeg/timeout.rb @@ -16,6 +16,7 @@ def pause def resume @paused = false + tick end def tick @@ -42,12 +43,9 @@ def initialize(duration, message = nil) end def loop - if !@paused && Time.now - @last_tick >= @duration - @current_thread.raise(::Timeout::Error, @message || self.class.name) - else - sleep 0.1 - loop - end + sleep 0.1 while @paused || Time.now - @last_tick <= @duration + + @current_thread.raise(::Timeout::Error, @message || self.class.name) end end end From f610951c6b5c3ffeb27999e02c17df3596cd3db9 Mon Sep 17 00:00:00 2001 From: bajankristof Date: Tue, 18 Jun 2024 22:39:03 +0200 Subject: [PATCH 2/2] chore: update version to 6.0.2 and document changes --- CHANGELOG | 5 +++++ lib/ffmpeg/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 71a89b2..ba9b82d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +== 6.0.2 2024-06-18 + +Fixes: +* Fixed a crash where extremely long media files would cause the transcoder to fail with SystemStackError: stack level too deep + == 6.0.1 2024-06-05 Fixes: diff --git a/lib/ffmpeg/version.rb b/lib/ffmpeg/version.rb index ab0431a..ffb5345 100644 --- a/lib/ffmpeg/version.rb +++ b/lib/ffmpeg/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module FFMPEG - VERSION = '6.0.1' + VERSION = '6.0.2' end