Page MenuHomePhabricator

Mapdata is varying on mobile, due to img srcset attribute
Closed, DuplicatePublic

Description

Now that "versioned maps" is deployed, we can see that some mapdata failures shouldn't be happening and must be due to bugs. When the revid parameter is present, we expect that parsed article content is stable aside from changes to content transcluded into the mapframe, and known bug T246314 where parsing is split and gives different results by interface language.

Taking one example of a map failing although revid is present, https://en.wikipedia.org/wiki/The_Ramble_and_Lake at revision 1081204090 yields groupId _d0cdae7fc26ee2076758eaf605a31364bb0b6cfc, returning a mapframe transcluded entirely from {{Central Park map}}. Neither the page, the template, or any of the transcluded sub-templates and modules have been modified since at least April. Filtering logs to request.query.title=The Ramble and Lake, we can see that the page has been consistently getting errors requesting the same wrong group IDs, since before the versioned maps deployment on May 11. The incorrect hashes that have been requested are _e217d6457677e415dcf9851a96d76d066f939dbb and _252b536d06ba5418bd0b2cf682523dacdc074b3f, and these have been consistently requested for over a month. Since requests with the revid parameter must have been rendered after the versioned maps deployment, we can know that the page contents are recently generated and not coming from a stale cache.

Perhaps something about the users' request is causing the parsed page to vary, as in the LanguageConverter case. This is a different bug, however—applying "uselang" to the mapdata API seems to do nothing, as expected.

We should determine whether these are logged-in or anonymous users, but judging by the user-agents, this seems to include anons. The only options which should be able to split cache are listed in ParserOptions: https://github.com/wikimedia/mediawiki/blob/master/includes/parser/ParserOptions.php#L81

  • dateformat
  • thumbsize
  • printable
  • userlang

An extension could add its own varying options as well.

We should try to find a way to vary options while requesting this page, to learn what conditions are causing the two incorrect groupIds. But generally, it seems that parser cache variations need to be handled by mapdata, or somehow ignored while parsing if that can be done safely.

Event Timeline

No luck trying to vary the page using the listed parser options:

  • Setting date format preference had no effect.
  • Bad requests all have the default dimensions of 300x320px, and setting my user preference thumbnail size to larger or smaller seems to have no effect on the interface or map (check for this as a its own bug?)
  • Tried printing with JS disabled, but the map renders correctly.
  • Tried requesting mapdata with many different uselang parameters, no change.

Next thing to try might be to peek at the production parser cache to understand the relationship between hashed options and varying mapframe content.

This comment was removed by awight.

Well that was easy enough, I found one variation by switching to the mobile view, this tries to request group ID _252b536d06ba5418bd0b2cf682523dacdc074b3f . Unknown why this causes the parsed mapframe to vary.

Hitting the mobile site API yields the mapframe variation: https://en.m.wikipedia.org/w/api.php?action=query&prop=mapdata&revids=1081204090

All of the differences are in image links, and follow this pattern, I think it's just the presence of srcset in the desktop rendering:

-  "description": "<a href=\"/wiki/File:Central_Park_23.jpg\" class=\"image\"><img alt=\"Central Park 23.jpg\" src=\"//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Central_Park_23.jpg/100px-Central_Park_23.jpg\" decoding=\"async\" width=\"100\" height=\"75\" srcset=\"//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Central_Park_23.jpg/150px-Central_Park_23.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Central_Park_23.jpg/200px-Central_Park_23.jpg 2x\" data-file-width=\"2048\" data-file-height=\"1535\" /></a><!--MW-PAGEIMAGES-CANDIDATE-21-->",
+ "description": "<a href=\"/wiki/File:Central_Park_23.jpg\" class=\"image\"><img alt=\"Central Park 23.jpg\" src=\"//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Central_Park_23.jpg/100px-Central_Park_23.jpg\" decoding=\"async\" width=\"100\" height=\"75\" data-file-width=\"2048\" data-file-height=\"1535\" /></a><!--MW-PAGEIMAGES-CANDIDATE-21-->",

Maybe the hash of mapdata should be taken before the final step of expanding wikitext to HTML?

awight renamed this task from Mapdata is varying for unknown reasons to Mapdata is varying on mobile, due to img srcset attribute.Jun 1 2022, 1:44 PM