简体   繁体   English

ImageMagick / Paperclip-大型工作期间回形针失败

[英]ImageMagick/Paperclip - Paperclip fails during large job

I'm using Paperclip with ImageMagick to process a few thousands images and upload them to S3. 我正在使用带有ImageMagick的Paperclip处理数千张图像并将其上传到S3。 It goes through hundreds of images with no issues, and then gives this error: 它遍历了数百张图像,没有任何问题,然后出现此错误:

An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick> An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick> command. Please install ImageMagick>

I've seen other questions referencing this error, but it seems strange to me that it can process fine one second, and then the next not be able to find ImageMagick. 我已经看到其他有关此错误的问题,但令我感到奇怪的是,它可以在一秒钟内处理完,然后在下一秒钟无法找到ImageMagick。 I'm processing with Sidekiq with 25 concurrent workers. 我正在与Sidekiq一起处理25名并发工人。

It's interesting to note that when shutting down sidekiq and restarting, it starts to work again. 有趣的是,当关闭sidekiq并重新启动时,它再次开始工作。

I was having the exact same problem, and have traced it down to a thread-safety issue in Paperclip. 我遇到了完全相同的问题,并将其追溯到Paperclip中的线程安全问题。 See https://github.com/thoughtbot/paperclip/issues/1709 参见https://github.com/thoughtbot/paperclip/issues/1709

似乎通过将与sidekiq一起使用的并发工作程序数限制为1可以解决此问题。这可以通过在启动sidekiq时指定-c 1来完成。

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

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