4

We are seeing the following symptoms:

  1. We routinely encounter stuck Generating pending image transforms tasks and have to manually mark the tasks as failed using SQL in the table craft_tasks.
  2. Broken image links on pages that use image transforms. This can sometimes be fixed with multiple page refreshes.
  3. The phperrors.log message PHP Fatal error: Maximum execution time of 120 seconds exceeded in /.../craft/app/vendor/imagine/imagine/lib/Imagine/Imagick/Image.php on line 228, even though are php.ini sets the max execution time to 300. I am pretty sure this is from the hard-coded limit set in AssetTransformsService.php

Our site has a large variety of images; the site is for a advertising agency. We can reproduce the problem pretty easily with animated GIFs, although size of the GIF does not alone seem to be the factor, because some 2mb GIFs never transform, while some 4mb GIFs transform very quickly.

I think there are a few issues going on:

  • The 120 second limit is affecting some images that take a long time to transform, resulting in a exceeded exec time log message.
  • Some images are never completing the transform process, seemingly regardless of the transform time, resulting in an exceeded exec time log message.
  • Some images mysteriously get stuck in the image transform process, resulting in no log messages.

Questions

  1. What is the recommended way for increasing the hard-coded 120 second limit?
  2. How can we track down the cause(s) of the stuck transforms?

AssetTransformsService.php Background

The Craft core file craft/app/services/AssetTransformsService.php has a hard-coded PHP max_execution_time of 120 seconds.

line 421: ini_set('max_execution_time', 120);

Some Craft Info

We are using Craft CMS version 2.6

Some Sever Info

We have imagick enabled as our image driver.

imagick module version  3.4.1
Imagick compiled with ImageMagick version   ImageMagick 6.7.2-7 2016-06-16 Q16 http://www.imagemagick.org
Imagick using ImageMagick library version   ImageMagick 6.7.2-7 2016-06-16 Q16 http://www.imagemagick.org
ImageMagick release date    2016-06-16
  • That probably a bug on our end, but are you sure the transforms are actually taking that long and not just hanging? Do they eventually complete if you up that value to 1000 or something? – Brad Bell Aug 11 '16 at 17:08
  • @BradBell: Increasing the time helped some images and had no affect on others. – Jay Haase Aug 11 '16 at 18:22
  • Are you sure the 120 second limit is the issue here, then? How big and what types of images are taking longer than your increased amount? – Brad Bell Aug 11 '16 at 23:58
  • @BradBell: I have added more info to the question. – Jay Haase Aug 12 '16 at 15:03
  • Can you email support@craftcms.com so we can send you a few patched files to test some animated GIF optimizations? – Brad Bell Aug 15 '16 at 22:48
3

Craft release 2.6.2911 has made a significant improvement, and with it, our troublesome animated GIFs are transforming correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.