Page MenuHomePhabricator

UnexpectedValueException from line 957 of /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php: Unknown type 'lang'
Closed, ResolvedPublic

Description

2015-04-29 21:46:33 mw1146 enwiki exception INFO: [eb969570] /w/api.php?titles=File%3AJere_Beasley.JPG&iiprop=timestamp%7Cuser%7Ccommen
t%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime%7Cmediatype%7Cextmetadata&prop=imageinfo&iimetadataversion=2&iiex
tmetadatamultilang=1&format=json&action=query&redirects=true&uselang=en   UnexpectedValueException from line 957 of /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php: Unknown type 'lang'
#0 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#1 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#2 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#3 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#4 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#5 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#6 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#7 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(860): ApiResult::applyTransformations()
#8 /srv/mediawiki/php-1.26wmf3/includes/api/ApiResult.php(244): ApiResult::applyTransformations()
#9 /srv/mediawiki/php-1.26wmf3/includes/api/ApiFormatJson.php(97): ApiResult->getResultData()
#10 /srv/mediawiki/php-1.26wmf3/includes/api/ApiMain.php(1250): ApiFormatJson->execute()
#11 /srv/mediawiki/php-1.26wmf3/includes/api/ApiMain.php(1108): ApiMain->printResult()
#12 /srv/mediawiki/php-1.26wmf3/includes/api/ApiMain.php(436): ApiMain->executeAction()
#13 /srv/mediawiki/php-1.26wmf3/includes/api/ApiMain.php(409): ApiMain->executeActionWithErrorHandling()
#14 /srv/mediawiki/php-1.26wmf3/api.php(90): ApiMain->execute()
#15 /srv/mediawiki/w/api.php(3): include()
#16 {main} {"private":false}
[14:59:10] <legoktm> bawolff: is it possible for image metadata to have a "_type" key somewhere when the API is returning it?
[14:59:26] <legoktm> bawolff: specifically https://en.wikipedia.org/w/api.php?titles=File%3AJere_Beasley.JPG&iiprop=timestamp|user|comment|url|size|sha1|metadata|mime|mediatype|extmetadata&prop=imageinfo&iimetadataversion=2&iiextmetadatamultilang=1&format=jsonfm&action=query&redirects=true&uselang=en
[14:59:41] <bawolff> yes
[14:59:47] <bawolff> in fact most should
[14:59:56] <legoktm> ahhhhhh
[15:00:06] <legoktm> well shit
[15:00:16] <bawolff> Did the api decide to reserve keys named "_type" ?
[15:00:18] <legoktm> yes
[15:00:24] <legoktm> everything that starts with _
[15:00:33] <bawolff> uh-oh
[15:00:40] <legoktm> ApiResult::META_TYPE = '_type';
[15:01:26] <bawolff> internally in the img_metadata blob, we use _type in order to say if an array is an ordered list of values, an unordered list, or a multiple language alternative thingy
[15:01:51] <bawolff> its then used to control if the output is a numbered list, a bullet list, or the language thingy
[15:02:21] <legoktm> ugh
[15:03:39] <legoktm> bawolff: so...if we renamed ApiResult::META_TYPE  = '_type' to '_meta_type', would that make it less bad?
[15:04:29] <bawolff> yes
[15:04:47] <bawolff> _type should be the only underscore starting thing that the image metadata uses

Event Timeline

Legoktm created this task.Apr 29 2015, 10:05 PM
Legoktm raised the priority of this task from to Unbreak Now!.
Legoktm updated the task description. (Show Details)
Legoktm added a project: MediaWiki-API.
Legoktm added a subscriber: Legoktm.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 29 2015, 10:05 PM
Legoktm updated the task description. (Show Details)Apr 29 2015, 10:06 PM
Legoktm set Security to None.

Change 207650 had a related patch set uploaded (by Legoktm):
ApiResult: change value of META_TYPE to '_meta_type'

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

I think this is due to cached entries. See also If5d101231ca913621c88e6683f

Anomie added a subscriber: Anomie.Apr 30 2015, 12:45 PM

This is a duplicate of T97469, but that should have been fixed by 207650 and 207279 before the timestamp on that log message. But I also note the URL in the report isn't giving errors anymore. So, WTF?

Also, T89971: ApiQueryImageInfo is crufty, needs rewrite.

Change 207769 had a related patch set uploaded (by Anomie):
Bump timestamp in 'ValidateExtendedMetadataCache' hook for T97469

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

Now that I think about it, wmf2 would still have been adding cache entries that break under wmf3. So updating the timestamp in the hook that invalidates the bad cache entries should take care of it.

Still no idea why the URL in the report isn't breaking anymore, unless we cycle those cache entries a lot faster than the 30-day expiry that is nominally set. Or something else happened to invalidate that particular one somehow.

Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Apr 30 2015, 2:10 PM

Still no idea why the URL in the report isn't breaking anymore, unless we cycle those cache entries a lot faster than the 30-day expiry that is nominally set. Or something else happened to invalidate that particular one somehow.

I believe bawolff manually purged that one on-wiki.

Change 207769 merged by jenkins-bot:
Bump timestamp in 'ValidateExtendedMetadataCache' hook for T97469

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

Change 207650 abandoned by Legoktm:
ApiResult: change value of META_TYPE to '_meta_type'

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

Anomie closed this task as Resolved.Apr 30 2015, 3:24 PM
Anomie claimed this task.

Let's call this Resolved now, unless circumstances prove otherwise.