I'm trying to use a sidekiq worker, which more or less saves a image file to database (using carrierwave). There are few files to save, which are a keyframes extracted from a video file. That's what that worker is about.
My image uploader has a few versions defined and looks as follows:
class KeyframeUploader < CarrierWave::Uploader::Base
# ...
# Keyframe thumbnail sizes
version :small do
process resize_to_fill: [180, 180], if: :square?
process resize_to_fill: [320, 180], if: :not_square?
end
version :medium do
process resize_to_fill: [460, 460], if: :square?
process resize_to_fill: [640, 460], if: :not_square?
end
version :large do
process resize_to_fill: [720, 720], if: :square?
process resize_to_fill: [1280, 720], if: :not_square?
end
private
# Checks if image is a square
def square? file
img = Magick::Image.read(file.path)
img[0].columns == img[0].rows
end
# Oposite to #square?
def not_square? file
!square? file
end
end
The thing is, when i'm trying to run my Sidekiq Worker, it throws Celluloid::FiberStackError: stack level too deep
and the only way to fix that is to remove my version definitions. It works only if there are not any version assigned to the uploader.
I have tried moving a save process to another worker or using Carrierwave::Backgrounder but i'm allways getting the same result.
Have you any idea what can i do about it?
Edit: My stracktrace is:
SystemStackError: stack level too deep from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/workspace.rb:86