Page MenuHomePhabricator

Updated TemplateData from transcluded items take a long time to show up
Open, Stalled, MediumPublic

Description

TemplateData from transcluded items (i.e. doc pages) takes a long time to show up in the API.

A temporary solution to this is to do a null edit (opening the page, and saving, without making any changes) which will cause the template data to propagate immediately.

Details

Reference
bz50372

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:47 AM
bzimport set Reference to bz50372.
bzimport added a subscriber: Unknown Object (MLST).

As does the fr implementation. I guess the question here is "how long does it take for TemplateData implementations to show up?"

(In reply to comment #2)

As does the fr implementation. I guess the question here is "how long does it
take for TemplateData implementations to show up?"

Do you mean,

  • "how long does it take newly-added TemplateData hinting to become available in the API for use in VisualEditor?",
  • "how long does it take the VisualEditor transclusions dialog to show with the TemplateData hinting when adding a template in?", or
  • "how long does it take the VisualEditor transclusions dialog to show with the TemplateData hinting on load?"

… or something else?

I'd go with A and C, Chris. If I add TemplateData to a template, go to an implementation of it that already exists and click the jigsaw piece, how long do I need between those actions to see the TemplateData?

(In reply to comment #4)

I'd go with A and C, Chris. If I add TemplateData to a template, go to an
implementation of it that already exists and click the jigsaw piece, how long
do I need between those actions to see the TemplateData?

A: This should be instantaneous - if not, action=purge on the template should do it; if not, this is an issue we need to follow-up in general with how MW works.
B: This is not yet done (bug 49778 which is being worked on right now).
C: This should be near-instantaneous (but we're about to change how this works to make it faster).

For A & C in particular as you've asked, seconds or even less. Was this during a time of serious server strain, maybe? Otherwise it sounds worrying.

Nope; remember that time I added it to the bugzilla tracked template, and nothing happened? Well, it started working finally some time today. I'm going to try implementing it in a couple of other minor places and look at what happens.

(In reply to comment #6)

Nope; remember that time I added it to the bugzilla tracked template, and
nothing happened?

No.

Well, it started working finally some time today.

That's not good. Did you purge the template, or did it get purged somehow (e.g. it was edited)?

I'm going to try implementing it in a couple of other minor places and look
at what happens.

OK.

Argh, that's not good - https://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Talkback is not updated even though it appears in transclusion, even after purge. Timo, thoughts?

The behavior seems inconsistent. Today, TemplateData was available in transclusions immediately after adding it to the template's documentation subpage. (tested with https://fr.wikipedia.org/wiki/Mod%C3%A8le:Unit%C3%A9 )

Though it is possible that VisualEditor and/or TemplateData do something wrong, in general there's nothing relevant in either VisualEditor or TemplateData that can delay the updating of the data.

The template data is changes by users by editing the wikitext of a Template page (or a page transcluded into a Template page). When they click "Save page", the MediaWiki parser detects the <templatedata> tag, tells the TemplateData extension to make sense of it, which then adds (or replaces) the parsed data in the database.

There is no deferred update here, it is replaced directly.

The API request to fetch templatedata grabs it directly from the database. This isn't specifically cached in anyway.

The only caching layer is in your browser cache and the general cache in the Wikimedia cluster for HTTP requests to content domain names (e.g. "en.wikipedia.org") which is Squid.

https://en.wikipedia.org/wiki/Template:Mileposts was updated 48 hours ago and still hasn't shown. That seems like a time period even the squids should blink at.

The extension page says:

"The TemplateData extension works through having a <templatedata> tag defined in the wikitext of a template page (optionally it can be transcluded into the template page as well). This is designed to be compatible with the common layout many wikis have of transcluding template documentation from a separate page (but is not required)."

And this seems to work partly, e.g. for https://en.wikipedia.org/wiki/Template:Italic_title. TemplateData is at https://en.wikipedia.org/wiki/Template:Italic_title/doc and it comes up at https://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Italic%20title&format=jsonfm , but it doesn't seem to actually work in VE (e.g. no description).

Then, https://en.wikipedia.org/wiki/Template:Dead_link appears set up similar, with TemplateData at https://en.wikipedia.org/wiki/Template:Dead_link/doc . But it does not come up at https://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Dead%20link&format=jsonfm . It does come up at https://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Dead%20link/doc&format=jsonfm (explicitly asking for the /doc page).

Wouldn't we avoid this delay if the template data were in a specific namespace, instead of being saved in one page, which is transcluded in another, which on its turn may be transcluded another, and so on, until the data finally gets to the template? See bug 50512.

I added[1] templatedata to en.wiki [[Template:Redirect]] yesterday (through the /doc transclusion) and also noticed that the main template page wasn't updating (I waited for about 10 minutes).

Then I did a null-edit on Template:Redirect and it was instantly there.

Roan mentioned something earlier (IRC or IRL, don't remember) about this perhaps being caused by the JobQueue (which we use to invalidate pages transcluding other pages, in this case the transclusion of /doc into Template:. *NOT* the transclusion of Template into articles, of course, that'd be insane).

CC-ing Roan, Tim and Aaron who may have more ideas about the cause of this.

As for TemplateData itself, it is triggered as a extension parser tag (<templatedata>) and during the parsing it adds page properties which MediaWiki ends up storing in the page_props db table. The API does a read query from that same table. Pretty basic.

So what could cause the read query to the page_props table to be delayed (or perhaps even not happen at all?) from the page properties added by a page that is transcluded (Template:Foo/doc) into a template page (Template:Foo).

JobQueue? Database replication? Something else?

Note that in my testing yesterday on Template:Redirect I ruled out HTTP caching (API cluster Squid) by making unique urls each time.

[1] https://en.wikipedia.org/w/index.php?title=Template%3ARedirect%2Fdoc&diff=562472124&oldid=562471783

Thought I'd drop a note and say that when I tried a null edit on https://en.wikipedia.org/wiki/Template:Mileposts, the overall template description loaded right away on https://en.wikipedia.org/wiki/British_Columbia_Highway_7. However, the parameter description (km=) did not load until I deleted the template from the article and reinserted the template anew.

Timo has narrowed down the issue to bug 5382 - we're working now to see whether we can fix that bug and so resolve this, or whether that will put too much weight on the cluster.

Observation:

  • Make a null edit to "Template:Pagetype".

So what is causing this to not be auto updated? I think T7382. But having trouble figuring out how come bug 5382 exists since we do have LinkUpdate and RefreshLinks2 which are triggered on edit from the job queue and update all pages linking to it, and the code in LinkUpdate includes all link tables and page properties.

You appear to just be seeing the effect of weeks of job queue lag, i.e. a system problem, not a MediaWiki problem.

Tim's change https://gerrit.wikimedia.org/r/#/c/72679/ (deployed) seems to have made it possible to force templatedata updates by just performing a null edit on the affected template, which is now safe to do on highly-used templates. Note that a null edit is an edit made by just pressing "Save page" without making _any_ changes to the template code itself.

What would be nice is if action=purge would force templatedata updates, like null edits do. This is necessary as many templates are protected so only admins can do null edits. Any editor can do an action=purge (I believe).

Moving this to be a site issue, and re-grading. Thanks to Tim's fix this isn't critical any more (users can 'just' null-edit touch the relevant template to cause TemplateData content to come through), but it's very irritating and we need to fix it.

(In reply to comment #23)

Thanks to Tim's fix this isn't
critical any more (users can 'just' null-edit touch the relevant template to
cause TemplateData content to come through)

Note: This workaround only works for templates that aren't widely used.

Widely-used templates are protected, and users can't null-edit them unless they are an admin (which drastically reduces the population of people who can add and edit TemplateData on the exact templates which would benefit from TemplateData most).

  • Bug 69647 has been marked as a duplicate of this bug. ***
SamB renamed this task from Updated page properties from transcluded items take a long time to show up to Updated TemplateData from transcluded items take a long time to show up.Apr 4 2015, 4:31 AM
SamB edited projects, added TemplateData, VisualEditor; removed WMF-General-or-Unknown.
SamB set Security to None.

What would be nice is if action=purge would force templatedata updates, like null edits do. This is necessary as many templates are protected so only admins can do null edits. Any editor can do an action=purge (I believe).

Hear, hear! And yes, I certainly seem to be able to purge pages I can't edit.

Krinkle moved this task from Backlog to Next-up on the TemplateData board.

This is an ongoing issue. I was contacted today from a third party wiki wondering why their VE citation tool wasn't working, and the template data wasn't coming through. It was this problem.

This issue seems to be the reason why templates of the citation tool are not displayed in VisualEditor. Even a null commit does not resolve the problem, at least for me. Can we expect any bug resolution soon or is it too early/the task is too much difficult to handle it for now? I (and probably other users) really need to use templates.

Thanks.

EDIT: Making a null edit is still useful. However, if someone does not see a template after that, manually running all the job tasks will help, in case they appear to be frozen (or if it takes a really long time to execute all the tasks by the wiki). To do so, execute: "php <path_to_wiki>/maintenance/runJobs.php".

Content translation relies in templateData to transfer templates across languages. In particular, templateData is used to check the names and aliases of the parameters of the corresponding templates across languages. The current issue makes the process of fixing this even more complex for editors as the case of T219346 illustrates.

This continues to be a serious problem.

Someone deleted some template data on cy wiki from a template on June 24, and it actually broke automatic citaitons on visual editor for *a month* for all citations using the cite web template; even though the edits had since been reverted, but because it will still pulling through templatedata that was a month outdated (i.e. missing.) It wasn't fixed until I did a null edit.

Details here: T258335

Mohammadmalek554 raised the priority of this task from Medium to Unbreak Now!.Sep 20 2020, 8:23 AM
Mohammadmalek554 subscribed.

Quoted Text

RhinosF1 lowered the priority of this task from Unbreak Now! to Medium.Sep 20 2020, 8:31 AM
RhinosF1 subscribed.

A 7 year old task isn't UBN

How about...
Either
A) add a shortcut somewhere in MW software to do a null template edit whenever its /doc page is saved (not everything has to be perfect)
or
B) add a note next to "This template is missing TemplateData, and its parameters have been autogenerated" so people know what's happening.

TemplateData is already too cryptic, though helpful, and it's frustrating when things are not showing up in VE for days (10 days in my latest case), for no obvious reason.