We are seeing the following symptoms:
- We routinely encounter stuck
Generating pending image transforms
tasks and have to manually mark the tasks as failed using SQL in the tablecraft_tasks
. - Broken image links on pages that use image transforms. This can sometimes be fixed with multiple page refreshes.
- The
phperrors.log
messagePHP 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 inAssetTransformsService.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
- What is the recommended way for increasing the hard-coded 120 second limit?
- 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