Page MenuHomePhabricator

ResourceLoaderImage missing file
Closed, ResolvedPublicPRODUCTION ERROR

Description

Spotted in production a number of times:

No such file or directory in /srv/mediawiki/php-1.25wmf16/includes/resourceloader/ResourceLoaderImage.php on line 348

This happens when we fail to convert the SVG to PNG. The actual error happens when attempting to access the non-existing temp PNG from the conversion. The rasterize() function call should let us know, ResourceLoaderImage should handle the failure more gracefully.

Event Timeline

demon created this task.Feb 13 2015, 10:46 PM
demon raised the priority of this task from to Needs Triage.
demon updated the task description. (Show Details)
demon added a subscriber: demon.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 13 2015, 10:46 PM
demon set Security to None.
demon added a subscriber: Krenair.
greg triaged this task as High priority.Feb 13 2015, 10:48 PM

I would like to point out that this code specifically special-cases rsvg and thus like 348 shouldn't be executed in WMF production at all. Why is it being executed?

Krenair added a comment.EditedFeb 13 2015, 10:51 PM

So in ResourceLoaderImage::rasterize we create a file and store it's name in $tempFilenamePng, which we then assume to exist afterwards, and try to call file_get_contents.

Except in this case, the SvgHandler::rasterize call goes to MediaHandler::removeBadFile which finds it's actually got a size of 0 according to stat(), so it's deleted:

2015-02-13 21:25:42 mw1104 enwiki: Removing bad 0-byte thumbnail "/tmp/ResourceLoaderImageLGQKSa". unlink() succeeded

And SvgHandler returns a MediaTransformError, but ResourceLoaderImage does not handle it.

Edit: Oh, yeah, here's the other interesting warning that came up in a grep for @Chad's temp file:

2015-02-13 21:25:42 mw1104 enwiki: thumbnail failed on mw1104: error 1 "Unknown option --no-external-files" from "'/usr/bin/'rsvg-convert --no-external-files -w 512 -h 512 -o '/tmp/ResourceLoaderImageLGQKSa' '/tmp/ResourceLoaderImage8nzo4N'"

I would like to point out that this code specifically special-cases rsvg and thus like 348 shouldn't be executed in WMF production at all. Why is it being executed?

krenair@tin:/srv/mediawiki-staging$ mwscript eval.php --wiki=enwiki
> var_dump( $wgSVGConverter );
string(11) "rsvg-secure"

Change 191383 had a related patch set uploaded (by Chad):
ResourceLoaderImage: tighten up svg handling

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

Patch-For-Review

Change 191383 merged by jenkins-bot:
ResourceLoaderImage: tighten up svg handling

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

Krenair closed this task as Resolved.Feb 18 2015, 10:00 PM
Krenair claimed this task.

Hopefully.

Change 191502 had a related patch set uploaded (by Chad):
ResourceLoaderImage: tighten up svg handling

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

Patch-For-Review

Change 191503 had a related patch set uploaded (by Chad):
ResourceLoaderImage: tighten up svg handling

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

Patch-For-Review

Change 191503 merged by jenkins-bot:
ResourceLoaderImage: tighten up svg handling

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

Change 191502 merged by jenkins-bot:
ResourceLoaderImage: tighten up svg handling

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:12 PM
Restricted Application added a project: Performance-Team. · View Herald TranscriptAug 28 2019, 11:12 PM