Skip to content

[6.x] Regenerate Glide images when the cached file is missing - #15199

Open
duncanmcclean wants to merge 1 commit into
6.xfrom
regenerate-missing-glide-images
Open

[6.x] Regenerate Glide images when the cached file is missing#15199
duncanmcclean wants to merge 1 commit into
6.xfrom
regenerate-missing-glide-images

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes a long-standing issue where Glide would throw an Unable to read file from location: containers/... exception when a previously generated image no longer exists on the cache disk.

This was happening because the ImageGenerator remembers the path of every generated image forever in the glide cache store, but never checks the file still exists. Whenever the generated file went away without the cache entry going with it — a deployment wiping the cache directory, manual deletion, or changing the image_manipulations.cache config option (which changes the cache disk without invalidating the store) — the stale path was returned and anything reading it would throw. Depending on where that happened, this surfaced as a 500 when serving the image, or as exceptions from addons like Responsive Images.

This PR fixes it by treating a remembered path whose file is missing as a cache miss: the entry is forgotten and the image is regenerated.

Fixes #7350

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ryanmitchell

Copy link
Copy Markdown
Contributor

Specifically on S3 disks this is going to cause a slowdown as there will be a HEAD operation to check existence now which is going to introduce round trip latency for every image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glide error: Unable to read file from location

2 participants