简体   繁体   English

上传到s3时的图像损坏,仅限生产。 (载波,发动机厂)

[英]Image corruption on upload to s3, production only. (carrierwave, engineyard)

I am using carrierwave to upload images to amazon s3. 我正在使用carrierwave将图像上传到亚马逊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 这是一个,例如: 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. 编辑:部署后的第一个图像上载尝试总是似乎失败500,但错误不会显示在日志中。 Not sure if that's relevent. 不确定这是否相关。

Edit2: Also seems to be occurring with dragonfly gem instead of carrierwave. 编辑2:似乎也发生了蜻蜓宝石而不是载波。

Thanks 谢谢

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. 如果它只发生在部署后的第一个图像上,我会怀疑你的应用程序仍在加载(或者至少是一些工作者),导致高CPU使用率并减慢上传过程,这可能会使其超时并破坏图像与此同时。

I assume that Engine Yard will reload your app only on the first request, which might be why. 我假设Engine Yard将仅在第一次请求时重新加载您的应用程序,这可能就是原因。 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. EC2上的小实例具有单个核心,并且当许多工作者重新启动时可能变得非常慢。

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 通过carrierwave /雾设置为EngineYard的进入,如下所述: http://www.engineyard.com/blog/2011/a-gentle-introduction-to-carrierwave/这里: 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 如果它是“假”,请检查此主题,因为您需要使用“authenticated_url”属性而不是返回的内容: http//groups.google.com/group/carrierwave/browse_thread/thread/2f727c77864ac923

There appears to have been an issue with gzip compression on jRuby (possibly with https) that has been resolved. 似乎已经解决了jRuby(可能使用https)上的gzip压缩问题。 If anyone needs version numbers from my stack, I can oblige. 如果有人需要我的堆栈中的版本号,我可以强迫。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM