[5.x]: "Generating Image Transform" Queue Constantly Running
Description
I am managing a site with ~100,000 image assets on a craft install.
Recently, I upgraded to Craft 5 and moved the transform process from AWS Lambda to the site's server. Ever since, the queue has been full of "Generating image transform" jobs.
Of course, I expect this after the initial migration, and the server gradually worked through a queue of ~500,000 jobs. But even after getting the queue down to 0, it is still regularly filling up with thousands of jobs (weeks later).
Moreover, the process stalls frequently, and I have to manually release jobs in order for it to continue.
The queue log is very opaque so this has been hard to debug. The only errors/warnings i am seeing have to do with reading .gif images, and are as follows:
2024-10-02 14:05:25 [queue.WARNING] [/home/ploi/patbates.com/vendor/pixelandtonic/imagine/src/Imagick/Imagine.php] Unable to open image /home/ploi/patbates.com/storage/runtime/assets/sources/321985.gif {"memory":8107552}
2024-10-02 14:05:25 [queue.WARNING] [/home/ploi/patbates.com/vendor/pixelandtonic/imagine/src/Imagick/Imagine.php:72] memory allocation failed `/home/ploi/patbates.com/storage/runtime/assets/sources/321985.gif' @ error/gif.c/ReadGIFImage/1306 {"memory":8107880}
Craft CMS version
5.4.5.1
PHP version
8.3.8
Operating system and version
Linux 5.15.0-118-generic
Database type and version
MySQL 8.0.39
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
- CKEditor 4.2.0
- DigitalOcean Spaces Filesystem 3.0.0
- Feed Me 6.4.0
- SEOmatic dev-develop-v5
I'm having a similar issue on Craft 5.7.0. It's currently a development site but I constantly am finding the queue full of thousands of pending images transforms even with template caching turned on and generateTransformsBeforePageLoad set to false.
Application Info
- Local DDEV version v1.24.4
- PHP version: 8.2.28
- Craft edition & version: Pro 5.7.0
- Database driver & version: MySQL 8.0.40
- Imagick 3.7.0 ImageMagick 6.9.11-60
Installed Plugins
- Amazon S3: 2.2.2
- AsyncQueue: 4.0.0
- Batch Actions: 2.1.0
- Blitz: 5.10.4
- CKEditor: 4.6.0
- Embedded Assets: 5.4.3
- Environment Label: 5.0.0
- Feed Me: 6.8.0
- Freeform: 5.10.9
- Matrix Extended: v4.2.1
- Minify: 5.0.0
- Retour: 5.0.9
- SEOmatic: 5.1.12
- Sprig: 3.6.1
Loaded Modules
- codeeditor: nystudio107\codeeditor\CodeEditor
- sprig-core: putyourlightson\sprig\Spri
@bryantwells @akukral Did either of you ever get any clarity on this issue? I am having a similar issue after a recent deploy, the queue is filling up with thousands of "Generating image transform" jobs and never seems to make any progress.
For now I've enabled generateTransformsBeforePageLoad(true) in my general config, which generates the transforms at page load rather than queuing them. The first page load is slow but the imagetransformindex table seems to be populating just fine now at a much reduced load on the server.
I reduced the images generated for sizes and src-set and tried my best to keep the images ONLY as named transforms though that is exceedingly hard to do. That helps keep it below the ≈100k mark but it definitely still always has a running flow of a few thousand though it does get hung up less. I also make sure to NEVER clear the Asset indexing data or Asset transform index caches because that seems to exacerbate the situation.
@daltonrooney @akukral I just ran into this and disabling SEOMatic stopped it, still not sure what is causing it though.
Update: It was an image in SEOMatic settings that no longer existed that triggered this for me. I had to dig around to find it.
@curtishenson what exactly? Also use SEOMatic, a custom image at an article? We had 100k jobs over night and killed the db a couple of times. So annoying, it grows per second
@DavidKabelitz I can't remember exactly which one it was, but it was either one of the default SEO image sources for a section or under Settings.
The image didn't exist anymore and Craft's image index was out of sync. Looked like somehow that would trigger a bunch of tasks and then loop, I assume trying to get that image. Fixing that image got rid of the problem completely.