Last modified: 2010-05-15 15:54:54 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 13776 - Images which are too small too need thumbnailing are repeatedly purged from Squid
Images which are too small too need thumbnailing are repeatedly purged from S...
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
  Show dependency treegraph
Reported: 2008-04-17 17:08 UTC by Tom Hughes
Modified: 2010-05-15 15:54 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Patch to stop repeated thumbnail image invalidations (3.17 KB, patch)
2008-04-17 17:09 UTC, Tom Hughes

Description Tom Hughes 2008-04-17 17:08:30 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.
Comment 1 Tom Hughes 2008-04-17 17:09:09 UTC
Created attachment 4826 [details]
Patch to stop repeated thumbnail image invalidations
Comment 2 Aaron Schulz 2008-05-02 19:41:40 UTC
I'd really like it if the purge could still be kept in File.php
Comment 3 Aaron Schulz 2008-05-02 21:29:37 UTC
Fixed in r34137.

Note You need to log in before you can comment on or make changes to this bug.