Page MenuHomePhabricator

Logo doesn't show on print styles on test wikipedia
Closed, ResolvedPublic3 Estimated Story Points

Description

When deploying the new print styles, I noticed that the logo was not showing.
When deploying there was a spike in errors:
https://logstash.wikimedia.org/app/kibana#/dashboard/1c3a4d80-35c2-11e7-b186-d1bc9cbdde4c?_g=h@ba40421&_a=h@69a9b14

The index notices have been fixed, but it looks like there are some other errors we will need to investigate:

Developer notes

During deployment we saw:

exception.message	   	PHP Warning: No such file or directory
t exception.trace	   	#0 /srv/mediawiki/php-1.31.0-wmf.2/includes/libs/CSSMin.php(124): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.31.0-wmf.2/skins/Vector/ResourceLoaderLessModule.php(47): CSSMin::encodeImageAsDataURI(string)
#2 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderFileModule.php(584): Vector\ResourceLoaderLessModule->getLessVars(DerivativeResourceLoaderContext)
#3 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderModule.php(844): ResourceLoaderFileModule->getDefinitionSummary(DerivativeResourceLoaderContext)
#4 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoader.php(667): ResourceLoaderModule->getVersionHash(DerivativeResourceLoaderContext)
#5 [internal function]: Closure$ResourceLoader::getCombinedVersion(string)
#6 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoader.php(680): array_map(Closure$ResourceLoader::getCombinedVersion;426, array)
#7 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderStartUpModule.php(434): ResourceLoader->getCombinedVersion(DerivativeResourceLoaderContext, array)
#8 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderStartUpModule.php(407): ResourceLoaderStartUpModule->getAllModuleHashes(DerivativeResourceLoaderContext)
#9 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderModule.php(844): ResourceLoaderStartUpModule->getDefinitionSummary(DerivativeResourceLoaderContext)
#10 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoader.php(667): ResourceLoaderModule->getVersionHash(DerivativeResourceLoaderContext)
#11 [internal function]: Closure$ResourceLoader::getCombinedVersion(string)
#12 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoader.php(680): array_map(Closure$ResourceLoader::getCombinedVersion;426, array)
#13 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoader.php(760): ResourceLoader->getCombinedVersion(ResourceLoaderContext, array)
#14 /srv/mediawiki/php-1.31.0-wmf.2/load.php(53): ResourceLoader->respond(ResourceLoaderContext)
#15 /srv/mediawiki/w/load.php(3): include(string)
#16 {main}

To help debug the change I had the styles instead deployed to test wiki:
https://test.wikipedia.org/wiki/Planet

The CSS file shows that the CSS relating to the pseudo element is not applying.
https://test.wikipedia.org/w/load.php?modules=skins.vector.styles.experimental.print&only=styles&debug=true
This should only happen when VectorPrintLogo is not defined.

The background image of the pseudo element at the top of the page resolves to "url(data:image/svg+xml;base64,)"

Event Timeline

Jdlrobson renamed this task from Logo doesn't show on print styles to Logo doesn't show on print styles on test wikipedia.Oct 9 2017, 8:46 PM
ovasileva set the point value for this task to 3.Oct 10 2017, 4:09 PM

Change 383390 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[operations/mediawiki-config@master] Enable Vector print logo on test wiki

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

ack. It didn't get re-added after the revert. That explains why I'm not seeing the logstash errors any more. Will try to get that deployed today so we can debug further.

Change 383390 merged by jenkins-bot:
[operations/mediawiki-config@master] Enable Vector print logo on test wiki

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

Change 383487 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@master] Expand relative URL - CSSMin needs absolute url

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

After the SWAT today I was able to get to the bottom of this. It is indeed because the URL is configured as a relative URL. We'll need to merge https://gerrit.wikimedia.org/r/383487 before we can go ahead with the deploy.

@Krinkle on gerrit said:

The Minerva config provides the logo as an image url, from /static, without a version hash. Normally unversioned urls are bad for cache, but these are fine because they're served from mediawiki-config/static, not mediawiki-core,skins,extensions - which are served via /w/static.php in production and should have a version hash appended by OutputPage::transformResourcePath, done automatically by CSSMin and ResourceLoader.
The /static served from mediawiki-config has an exception in Apache config to always cache it for long, even without a version hash, which means it might by default it won't roll over, but practice is to purge Varnish manually after deployment.
The code in Vector cannot use this logic in the current way because as being a file from outside MediaWiki, it cannot be read from disk, and has no url-to-file or file-to-url mapping (e.g. no wgScriptPath=$IP, or some such).
Using these in Vector as a url is fine, but if you intent to make use of ResourceLoader/CSSMin/embedding in some way, then they need to either be served from a MediaWiki skin/extension directory, or the Vector config needs to be given a local file path and external url separately so that it has a way to read the file and embed it, + fallback to normal url for debug mode and in case it is a non-SVG file (per CSSMin). The current method makes a lot of specific assumptions that break (e.g. large files embed the url "false", and any non-SVG file would break in IE8 due to the url not being known).

Since our existing config is a relative url e.g. /images/mobile/wikipedia-wordmark-en.png we'll need to either

  • resolve this into a file path
  • Use a background image url (not data uri)
  • use a different config setup which uses files

Change 383645 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@wmf/1.31.0-wmf.3] Print logo should use an absolute URI

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

Change 383487 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Print logo should use an absolute URI

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

Change 383706 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@wmf/1.31.0-wmf.2] Print logo should use an absolute URI

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

Change 383645 merged by jenkins-bot:
[mediawiki/skins/Vector@wmf/1.31.0-wmf.3] Print logo should use an absolute URI

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

Change 383706 merged by jenkins-bot:
[mediawiki/skins/Vector@wmf/1.31.0-wmf.2] Print logo should use an absolute URI

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

Mentioned in SAL (#wikimedia-operations) [2017-10-11T23:37:56Z] <thcipriani@tin> Synchronized php-1.31.0-wmf.3/skins/Vector/ResourceLoaderLessModule.php: SWAT: [[gerrit:383706|Print logo should use an absolute URI]] T177800 (duration: 00m 50s)

Mentioned in SAL (#wikimedia-operations) [2017-10-11T23:40:27Z] <thcipriani@tin> Synchronized php-1.31.0-wmf.2/skins/Vector/ResourceLoaderLessModule.php: SWAT: [[gerrit:383706|Print logo should use an absolute URI]] T177800 (duration: 00m 49s)

ovasileva claimed this task.
ovasileva subscribed.

checked logos on enwiki, ruwiki, hiwiki - correct wordmark appears
thwiki, bgwiki, etc - english wordmark appears (separate issue)

looks good!