Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.2 #3

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 4 additions & 6 deletions lib/ffmpeg/timeout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def pause

def resume
@paused = false
tick
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one seems to cause a race condition, I would change the order of the lines

the tick call is setting the @last_tick to the current date to not cause a timeout after a long pause, but the loop int the other thread can do its check between setting @paused to false and setting the @last_tick to the current time. this could end up breaking the sleep loop while we meant to keep it running (hence setting the time to be Time.now)

end

def tick
Expand All @@ -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
2 changes: 1 addition & 1 deletion lib/ffmpeg/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module FFMPEG
VERSION = '6.0.1'
VERSION = '6.0.2'
end