Last modified: 2010-05-15 15:54:54 UTC
If an image is too small to need thumbnailing then every reference to it in a page causes an attempt to invalidate the (non-existent) thumbnail from any Squid caches.
The problem is that transform() in filerepo/File.php calculate the filename and URL of the thumbnail image then, if the file does not exist it calls the handler's doTransform() method to create the thumbnail. Once that returns the ThmbnailImage object it asks the squid caches to invalidate the thumbnail URL.
That breaks if doTransform() decides that the image doesn't really need thumbnailing due to it's size as it then returns a ThumbnailImage object that refers to the original file, but transform() still invalidates the thumbnail URL even though no thumbnail was created.
Because no thumbnail was created, next time the image is required we go round the whole loop again.
If as I did you have a page with hundreds or thousands of instances of a small image then every single one of those causes an attempted cache invalidation. Due to a second problem with the Squid cache invalidation logic (reported separately) each one takes about 8 seconds which causes the whole page to take many minutes or even hours to render.
My current fix (patch attached) pushes down the Squid cache invalidation into the doTransform() method so that it is only done is a new thumbnail is really created.
Created attachment 4826 [details]
Patch to stop repeated thumbnail image invalidations
I'd really like it if the purge could still be kept in File.php
Fixed in r34137.