Project

General

Profile

Actions

Feature #81989

open

ImageMagick - Prevent Concurrent Processing of Image Files

Added by Joseph Linden almost 7 years ago. Updated 11 months ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Image Cropping
Target version:
-
Start date:
2017-07-27
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.4
Tags:
ImageMagick
Complexity:
Sprint Focus:

Description

Current Setup:

  • Apache 2.4.23
  • PHP 7.0.20 Nonthread safe
  • TYPO3 7.6.20
  • ImageMagick 6.7.8-9

Things to note:

  1. A website uploads pictures in extremely high resolution, meaning that the average filesize of each file is about 30-40MB.
  2. There are a number of custom content elements, each with its own DataProcessor. For instance, one creates 8 different processed versions of an image for various viewports.
  3. Switching to GraphicsMagick did not solve the problem.

Problem:

ImageMagick fails to process all images for all viewports and thus results in creating corrupted files when multiple requests to the server are made that causes the same image files to be processed multiple times simultaneously.

Previously attempted strategies, etc.:

  1. Create a database locking mechanism that prevents a second conversion if a flag is set signaling that processing is already in progress.
  2. Create smaller versions of the file to then convert instead of the original
  3. Analyzing the errors thrown by ImageMagick. No recognizable pattern was noticable. The conversion failed at multiple points with different pictures with different resolutions.

Next strategy

Under the assumption that ImageMagick is working properly AND/OR cannot be reconfigured to prevent this problem:

  1. Implement preprocessing by utilizing appropriate hooks in DataHandler. For this to be reliable, we would like to limit requests to those made by the TYPO3 backend, thus, essentially turning off "on the fly" conversion.

Preliminary conclusions

  1. The overall amount of traffic seems to be irrelevant. This has been tested in development and production environments. It is sufficient that two processes are started (at least more or less) simultaneously to process an image that causes ImageMagick to fail, at least partially.
  2. The filesize seems to be a large contributing factor. If it is smaller than 5MB, this problem rarely (if at all) occurs.

Nice to have

  1. We would like to be able to use the original file with no intermediary reduction of the image quality.

TL;DR

Concurrent processing of large images using ImageMagick fails.


Files


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #92188: Deferred image processing in the backend is only partly implementedClosed2020-09-03

Actions
Actions

Also available in: Atom PDF