Page MenuHomePhabricator

PHP Notice: Undefined index: wgKartographerLiveData
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.23

message
PHP Notice: Undefined index: wgKartographerLiveData

https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/a01d607f58/lib/includes/Formatters/CachingKartographerEmbeddingHandler.php#L88

Notes

~6 of these since rolling 1.35.0-wmf.23 to group1 (T233871). Impact unclear. Doesn't appear to result in a user-facing error.

Maybe similar to T223085?

Details

Request ID
XmlLXgpAMMwAAIsG4mkAAABG
Request URL
https://www.wikidata.org/w/api.php?action=wbformatvalue&format=json&datavalue=%7B%22value%22%3A%7B%22latitude%22%3A50.87305555555555%2C%22longitude%22%3A0.00002777777777777778%2C%22globe%22%3A%22http%3A%2F%2Fwww.wikidata.org%2Fentity%2FQ2%22%2C%22precision%22%3A0.00002777777777777778%7D%2C%22type%22%3A%22globecoordinate%22%7D&generate=text%2Fhtml%3B%20disposition%3Dverbose-preview&property=P625&errorformat=plaintext&uselang=en&options=%7B%22lang%22%3A%22en%22%7D
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/CachingKartographerEmbeddingHandler.php(88): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/GlobeCoordinateKartographerFormatter.php(78): Wikibase\Lib\Formatters\CachingKartographerEmbeddingHandler->getPreviewHtml(DataValues\Geo\Values\GlobeCoordinateValue, LanguageEn)
#2 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/DispatchingValueFormatter.php(75): Wikibase\Lib\Formatters\GlobeCoordinateKartographerFormatter->format(DataValues\Geo\Values\GlobeCoordinateValue)
#3 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/PropertyValueSnakFormatter.php(148): Wikibase\Lib\Formatters\DispatchingValueFormatter->formatValue(DataValues\Geo\Values\GlobeCoordinateValue, string)
#4 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/PropertyValueSnakFormatter.php(117): Wikibase\Lib\Formatters\PropertyValueSnakFormatter->formatValue(DataValues\Geo\Values\GlobeCoordinateValue, string)
#5 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/DispatchingSnakFormatter.php(151): Wikibase\Lib\Formatters\PropertyValueSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#6 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/ErrorHandlingSnakFormatter.php(67): Wikibase\Lib\Formatters\DispatchingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#7 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/repo/includes/Api/FormatSnakValue.php(115): Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#8 /srv/mediawiki/php-1.35.0-wmf.23/extensions/Wikibase/repo/includes/Api/FormatSnakValue.php(92): Wikibase\Repo\Api\FormatSnakValue->formatValue(array, DataValues\Geo\Values\GlobeCoordinateValue, NULL)
#9 /srv/mediawiki/php-1.35.0-wmf.23/includes/api/ApiMain.php(1590): Wikibase\Repo\Api\FormatSnakValue->execute()
#10 /srv/mediawiki/php-1.35.0-wmf.23/includes/api/ApiMain.php(522): ApiMain->executeAction()
#11 /srv/mediawiki/php-1.35.0-wmf.23/includes/api/ApiMain.php(493): ApiMain->executeActionWithErrorHandling()
#12 /srv/mediawiki/php-1.35.0-wmf.23/api.php(84): ApiMain->execute()
#13 /srv/mediawiki/w/api.php(3): require(string)
#14 {main}

Event Timeline

Krinkle added a subscriber: Krinkle.

Undefined variables seem quite serious, especially wg-config variables. Blocker imho.

I do not know the involved CachingKartographerEmbeddingHandler class in Wikibase very well. But according to what I see in https://codesearch.wmflabs.org/search/?q=wgKartographerLiveData I suspect that:

  1. I believe this is not a serious issue. Just a notice. The missing variable is cast to an empty array. From there, I believe all following code is fine with an empty array.
  2. The root cause appears to be a mismatch between the code in the Kartographer extension where the variable is created, and the code in Wikibase that consumes it. Note that the variable is only created under specific circumstances, but Wikibase always expects it.

Just a few lines below in the same class is a check that creates the variable in case it is missing. https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/master/lib/includes/Formatters/CachingKartographerEmbeddingHandler.php#174 But this line is in JavaScript. It appears like the same check needs to be done in PHP.

I haven't managed to find any documentation about wgKartographerLiveData anywhere, but as best I can tell from the Kartographer codebase, it's not safe to assume it will be defined. It looks like @hoo originally wrote this code, so maybe he can provide some insight.

brennen triaged this task as Unbreak Now! priority.Mar 12 2020, 6:03 PM

Setting as UBN as long as this is marked a train blocker. Sounds like it's not serious in terms of real impact but it would be nice to eliminate logspam.

brennen lowered the priority of this task from Unbreak Now! to Medium.Mar 12 2020, 7:02 PM

Per conversation in RelEng and input here, this doesn't seem severe enough to hold up the train (particularly over the weekend).

wgKartographerLiveData has to do with previewing maps. T145615: Preview with <maplink> does not work explains that it could not query the server because since the entry was not saved yet, the maps service (i presume geoshape, geoline service etc) did not have the result available yet for rendering.

Change 579525 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Wikibase@master] Do not assume wgKartographerLiveData is always set

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

Change 579525 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Do not assume wgKartographerLiveData is always set

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

Change 580112 had a related patch set uploaded (by Krinkle; owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.23] Do not assume wgKartographerLiveData is always set

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

Change 580112 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.23] Do not assume wgKartographerLiveData is always set

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

Mentioned in SAL (#wikimedia-operations) [2020-03-17T00:57:15Z] <krinkle@deploy1001> Synchronized php-1.35.0-wmf.23/extensions/Wikibase/lib/includes/Formatters/: Ic77b2c6b33a, T247458 (duration: 01m 12s)

Krinkle claimed this task.