Answers.Body: <p>Craft release 2.6.2911 has made a significant improvement, and with it, our troublesome animated GIFs are transforming correctly.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T03:44:12.463Z
Answers.LastActivityDate: 2016-08-17T03:44:12.463Z
Answers.UserDisplayName: Jay Haase
Body: <p>We are seeing the following symptoms:</p>
  
  <ol>
  <li>We routinely encounter stuck <code>Generating pending image transforms</code> tasks and have to manually mark the tasks as failed using SQL in the table <code>craft_tasks</code>.</li>
  <li>Broken image links on pages that use image transforms. This can sometimes be fixed with multiple page refreshes.</li>
  <li>The <code>phperrors.log</code> message <code>PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /.../craft/app/vendor/imagine/imagine/lib/Imagine/Imagick/Image.php on line 228</code>, 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 <code>AssetTransformsService.php</code></li>
  </ol>
  
  <p>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.</p>
  
  <p>I think there are a few issues going on:</p>
  
  <ul>
  <li>The 120 second limit is affecting some images that take a long time to transform, resulting in a exceeded exec time log message.</li>
  <li>Some images are never completing the transform process, seemingly regardless of the transform time, resulting in an exceeded exec time log message.</li>
  <li>Some images mysteriously get stuck in the image transform process, resulting in no log messages.</li>
  </ul>
  
  <p><strong>Questions</strong></p>
  
  <ol>
  <li>What is the recommended way for increasing the hard-coded 120 second limit?</li>
  <li>How can we track down the cause(s) of the stuck transforms?</li>
  </ol>
  
  <p><strong>AssetTransformsService.php Background</strong></p>
  
  <p>The Craft core file <code>craft/app/services/AssetTransformsService.php</code> has a hard-coded PHP <code>max_execution_time</code> of 120 seconds.</p>
  
  <pre><code>line 421: ini_set('max_execution_time', 120);
  </code></pre>
  
  <p><strong>Some Craft Info</strong></p>
  
  <p>We are using Craft CMS version 2.6</p>
  
  <p><strong>Some Sever Info</strong></p>
  
  <p>We have <code>imagick</code> enabled as our image driver.</p>
  
  <pre><code>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
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-11T17:08:18.200Z
Comments.Text: 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?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-11T18:22:09.200Z
Comments.Text: @BradBell: Increasing the time helped some images and had no affect on others.
Comments.UserDisplayName: Jay Haase
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-11T23:58:37.737Z
Comments.Text: 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?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-12T15:03:53.437Z
Comments.Text: @BradBell: I have added more info to the question.
Comments.UserDisplayName: Jay Haase
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-15T22:48:04.063Z
Comments.Text: Can you email support@craftcms.com so we can send you a few patched files to test some animated GIF optimizations?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-17T03:41:58.107Z
Comments.Text: @BradBell: the latest release (2.6.2911) with your patches seems to have helped a bunch. The animated GIFs we were having problems are now transforming. Thank you for your world class support!
Comments.UserDisplayName: Jay Haase
Tags: <image-transforms>
Title: Image Transform Problems, Timeouts, Stuck Transforms
ThreadText: # Image Transform Problems, Timeouts, Stuck Transforms
  
  (Asked by: username_0 on 2016-08-11)
  
  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
  
  ```
  
  **Tags:** image-transforms
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_0**: @username_1: Increasing the time helped some images and had no affect on others.  
  > **username_1**: 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?  
  > **username_0**: @username_1: I have added more info to the question.  
  > **username_1**: Can you email support@craftcms.com so we can send you a few patched files to test some animated GIF optimizations?  
  > **username_0**: @username_1: the latest release (2.6.2911) with your patches seems to have helped a bunch. The animated GIFs we were having problems are now transforming. Thank you for your world class support!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-08-17. Score: 3 | Accepted answer
  
  Craft release 2.6.2911 has made a significant improvement, and with it, our troublesome animated GIFs are transforming correctly.
  
  
  ---
  
  