5

I am using carrierwave to upload images to amazon s3. This works great on development, but not when I push it to my server (engineyard cloud trial).

The process works fine, no errors are thrown, and a link is given back. However, the actual image is corrupted, somehow.

Here's one, for example: https://s3.amazonaws.com/ZenBucket/uploads/goal/photo/30/guinness-toucan.jpg

Can anyone tell me how it's being corrupted, or what could be doing it?

Edit: The first image upload attempt after deploying always seems to fail 500, but the error doesn't show in the log. Not sure if that's relevent.

Edit2: Also seems to be occurring with dragonfly gem instead of carrierwave.

Thanks

Peter Ehrlich
  • 6,969
  • 4
  • 49
  • 65
  • So others have been experiencing this as well? (So I gather from the upvotes) – Peter Ehrlich Feb 19 '12 at 22:35
  • Can you provide the original source image you're attempting to upload and are all images corrupted or just the first after a deploy? – Dan Feb 21 '12 at 00:52
  • Here's the original: http://yfrog.com/ms0pubj - All images corrupted, always. I'll extend the bounty if you can figure this one out – Peter Ehrlich Feb 21 '12 at 01:05
  • Are you uploading image locally or from a remote location? Also, what's the store_dir you're uploading to for s3? If it works in dev but not production, then it might have to do with your deployment settings. – Dominic Tancredi Feb 21 '12 at 03:46
  • I'm not sure what you mean by remote location, but it has been tried from multiple machines. Store dir is what you see above: "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}". – Peter Ehrlich Feb 21 '12 at 14:44
  • Can you post the log with the 500 error? – james2m Mar 12 '12 at 21:44

3 Answers3

0

If it only happens on the first image after a deploy, I would suspect that your app is still loading (or at least some workers are), causing high cpu usage and slowing down the upload process, which might make it timeout and corrupt the image at the same time.

I assume that Engine Yard will reload your app only on the first request, which might be why. You should try just "curling" your app after a deploy and wait a couple minutes to see if that helps.

Small instances on EC2 have a single core and can become quite slow when many workers are being restarted.

Carl Mercier
  • 1,231
  • 1
  • 12
  • 10
0

Go through the carrierwave / fog setup for EngineYard, as described here: http://www.engineyard.com/blog/2011/a-gentle-introduction-to-carrierwave/ and here: http://docs.engineyard.com/use-carrierwave-and-optionally-fog-to-upload-and-store-files.html

Is your "fog" public set to "false" or "true"? If it's "false", check this thread, as you'll need to use the "authenticated_url" property instead of what's returned: http://groups.google.com/group/carrierwave/browse_thread/thread/2f727c77864ac923

Dominic Tancredi
  • 41,134
  • 7
  • 34
  • 50
0

There appears to have been an issue with gzip compression on jRuby (possibly with https) that has been resolved. If anyone needs version numbers from my stack, I can oblige.

Peter Ehrlich
  • 6,969
  • 4
  • 49
  • 65