Error: Maximum execution time of 300 seconds exceeded, /modules/contrib/imagemagick/src/Plugin/FileMetadata/ImagemagickIdentify.php at line 259

Created on 19 March 2024, about 1 year ago

Problem/Motivation

Note: Opening this issue for version 8.x-3.4, since this is the version running on the client project, migration to D10 is in progress

This may be an edge case, but I'm opening the issue in case someone else encounters this.

ImageMagic is failing on the above line when the requested file does not exist. Our monitoring/error collection system has additional information as follows:

The specified file 's3://articles/feeds-state-47661/k4qDqJ98xysz-aJnTBWOL3A7fHfs99QwqqqHsV80giQ/w:820/h:546/rt:fill/g:fp:0.5:0.5/q:90/el:1/ahr0chm6ly9zmy51cy1lyxn0ltiuyw1hem9uyxdzlmnvbs9uexnmb2n1cy9kaxn0cmlidxrpb24ty2vudgvyluleqs1lehbsy.png' could not be copied to 'temporary://imagemagick_HyxYTh.png'

http.method: GET, 
http.url: https://<aws-s3-public-url>/s3/files/styles/d06_traditional/s3/articles/feeds-state-47661/k4qDqJ98xysz-aJnTBWOL3A7fHfs99QwqqqHsV80giQ/w%3A820/h%3A546/rt%3Afill/g%3Afp%3A0.5%3A0.5/q%3A90/el%3A1/ahr0chm6ly9zmy51cy1lyxn0ltiuyw1hem9uyxdzlmnvbs9uexnmb2n1cy9kaxn0cmlidxrpb24ty2vudgvyluleqs1lehbsy.png?h=4bc2b340&itok=wpvsloZ3

Note: The above file does not exist on the S3 instance.

Proposed resolution

Handle the missing file more gracefully instead of waiting for the file to download and timing out. In this instance this was a staging site that was loading a page with images that were in the file managed table, but did not actually exist on the S3 instance (these were test images that had been removed from the S3 image outside of Drupal, so the file_managed table still had records for the images).

While this is an edge case, and the issue was resolved by removing test data from the staging site via Drupal, and cleaning the file managed table to remove the missing images, I have known clients to delete images and files outside of Drupal as well, so it would be great if this could be gracefully handled instead of resulting in a 500 error due to a timeout.

πŸ› Bug report
Status

Active

Version

3.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States lhridley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024