Page MenuHomePhabricator

Weird expansion limit behavior discovered
Open, Needs TriagePublic

Description

Today on the Czech Wikipedia we noticed our Clade template started to produce a strange error, see e.g. https://cs.wikipedia.org/wiki/Paranthodon_africanus. There are several weird things about it.

First, the error can't be translated, because translatewiki/any local messages do not know about "Expansion depth limit exceeded" message shown there.

Second, the error seems to show only in half of articles in expansion-depth-exceeded-category category. The other half is in the category without any visible error there.

Third, the expansion limit seems too low now. If I count correctly, it is 12, which makes the templates like Clade completely unusable.

Fourth, that strange error makes the whole graph break. Compare to the post-expand-template-inclusion-category category that just shows the template names, does not break page structure.

Event Timeline

First, the error can't be translated, because translatewiki/any local messages do not know about "Expansion depth limit exceeded" message shown there.

Indeed it's apparently hardcoded in English. The code dates back to 2008: 2c76c39737081017e99760d4d3dd11f79461370a.

Second, the error seems to show only in half of articles in expansion-depth-exceeded-category category. The other half is in the category without any visible error there.

If the expansion depth is exceeded somewhere with no output, e.g. inside the condition (first parameter) of {{#if:…}}, then you won't get any output.

Third, the expansion limit seems too low now. If I count correctly, it is 12, which makes the templates like Clade completely unusable.

$wgMaxPPExpandDepth is defined to be 40, and I don't think it ever changed. How are you counting? :D

Fourth, that strange error makes the whole graph break. Compare to the post-expand-template-inclusion-category category that just shows the template names, does not break page structure.

This probably depends on what is in the templates… if this error causes some template that outputs </table> to not output it, then everything will be messed up. That said, I don't see any terrible problems on that page:

image.png (2×3 px, 688 KB)

Third, the expansion limit seems too low now. If I count correctly, it is 12, which makes the templates like Clade completely unusable.

$wgMaxPPExpandDepth is defined to be 40, and I don't think it ever changed. How are you counting? :D

To clarify. It seems that each nested clade counts for 3 expansion levels:

  • One for the {{klad|…}} invocation
  • One for the {{#if:…}} inside the template
  • One for the {{{2}}} inside the template

So you get an error inside the 14th clade.

The corresponding English Wikipedia template has a section that describes the limitations much better: https://en.wikipedia.org/wiki/Template:Clade#Large_cladograms

The limit there is 20 clades rather than 13, because the templae is written as a Lua module, so you only get 2 expansion levels per clade:

  • One for the {{clade|…}}
  • One for the {{#invoke:…}} inside the template

There is task T23521 about the lack of localisation. I think the other behaviors are as expected. I can reply if you have any other questions about it :)

It is not expected to see blockquote in the place of the issue because of broken error mesage, it is not expected to have category partially full of articles with no issue at all and the number is still 12 clade templates, not 14 (there would be no problematic article with a limit of 14), resp. 11 with the categorized articles without any visible error.

And even weirder is that this behavior is completely new, in August last year no article has been producing this error and I don't remember any Tech news that would warn about any change in this?

There is task T23521 about the lack of localisation.

Thank you for the link and your activity in the task.

I don't think it's new. I can't prove it, but I remember working around issues with expansion depth when writing complicated templates in 2012 or so. (Since then, Lua modules mostly replaced complicated templates, so the issue is seen less often.) On this particular page, the problematic template was added recently (https://cs.wikipedia.org/w/index.php?title=Paranthodon_africanus&diff=prev&oldid=17270629&diffonly=0).

You pointed to a revision, where it was just moved around in the page, but anyway, if you look into another article: https://cs.wikipedia.org/wiki/Mechy, the error was added in April, 2019. But webarchive shows there was still no error in page in August, 2019: http://web.archive.org/web/20190827164015/https://cs.wikipedia.org/wiki/Mechy