Page MenuHomePhabricator

upgradeRow() constantly triggered for invalid SVG and DjVu files
Closed, ResolvedPublic

Description

MediaHandler::isMetadataInvalid() should return METADATA_BAD only when there is something wrong with the metadata, not when there is something wrong with the file. A file validation error should never cause isMetadataValid() to return false, since this causes upgradeRow() to be called every time the image is used in any way.

The SVG and DjVu handlers get this wrong. This causes high DB master load, and also errors such as bug 27639.

I would humbly point to OggHandler as a possible model for appropriate handling of invalid files: an invalid file causes an error message to be saved into the metadata array, and then getLongDesc() is overridden to display the error message to the user on the image description page. getWidth() etc. returns zero for an invalid file.


Version: 1.21.x
Severity: major

Details

Reference
bz41090

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 12:53 AM
bzimport set Reference to bz41090.
bzimport added a subscriber: Unknown Object (MLST).

Tim:
Aaron's patch ("Store "bad metadata" placeholder metadata for SVGs") got merged in November 2012 - did this solve the problem, or is there more to do?

There is still DjVu

Change 134976 had a related patch set uploaded by Brian Wolff:
Make sure DjVu files do not attempt metadata extraction repeatedly

https://gerrit.wikimedia.org/r/134976

Doesn't really look like this is actually much of an issue though:

MariaDB [commonswiki_p]> select count(*) from image where img_major_mime = 'image' and img_minor_mime = 'vnd.djvu' and img_media_type= 'BITMAP' and img_metadata in ( '', '0', 'a:0:{}' );
+----------+

count(*)

+----------+

0

+----------+

Change 134976 merged by jenkins-bot:
Make sure DjVu files do not attempt metadata extraction repeatedly

https://gerrit.wikimedia.org/r/134976

Gilles raised the priority of this task from Normal to Unbreak Now!.Dec 4 2014, 10:20 AM
Gilles added a project: Multimedia.
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Normal.Dec 4 2014, 11:22 AM