Search code examples
ruby-on-railsruby-on-rails-3.2imagemagickcarrierwavermagick

Carrierwave and Imagemagick timeouts on upload


I'm seeing a Completed 500 Internal Server Error in 55ms in my logs when users uploads a large image (800px higher @ 100kb+).

I wanted to know if there is any way I can set the timeout to a higher setting within my Rails app, or if there is a Carrierwave configuration I can set for slow user connections.

# Error log
Completed 500 Internal Server Error in 55ms

Magick::FatalImageMagickError (time limit exceeded `jibberish' @ fatal/cache.c/GetImagePixelCache/2180):
  app/controllers/images_controller.rb:5:in `new'
  app/controllers/imagess_controller.rb:5:in `create'

The app stops responding and I have to restart it before it gets going again. Unfortunately, it will have the same problems if try to upload another image.


Solution

  • are you uploading the images on the app? usually the best practice is to use a external file database like amazon s3, remember rails can only handle one request at a time, unless you are using unicorn or something, so i dont think you can extend that timeout time, maybe you could use a delayed job or something but i dont think its a good practice, here is a railscasts episode i find usefull: http://railscasts.com/episodes/383-uploading-to-amazon-s3