Page MenuHomePhabricator

Server error on https://de.wikipedia.org/wiki/Bild_(Zeitung) due to {{Auflagen-Diagramm}}
Open, Needs TriagePublicBUG REPORT

Description

List of steps to reproduce
https://de.wikipedia.org/w/index.php?title=Bild_(Zeitung)&oldid=221538811

What happens?:
Server error:
Request ID: 1e71878e-d7ed-45b0-b454-2f5038520be7
Allowed memory size of 698351616 bytes exhausted (tried to allocate 20480 bytes)

What should have happened instead?:
The article should be shown

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
Happens on various browsers

Event Timeline

Narrowed down the minimum wikitext from the page which is causing the memory exhaustion.

{{Auflagen-Diagramm|Zeitungen|1090|Verk|5000000}}
{{Metadaten Auflagen Zeitungen DE|1086|Verk}}
{{Metadaten Auflagen Zeitschriften DE|2378|Verk}}
ToBeFree subscribed.

Removing {{Auflagen-Diagramm|Zeitungen|1090|Verk|5000000}} solved the problem. https://de.wikipedia.org/w/index.php?title=Bild_(Zeitung)&oldid=221538811 contains the still-broken revision.

Possibly same as T230076?

Appears to be this, yes.

Message:

[3334b742-981f-4ae1-a420-290cd142d139] PHP Fatal error: Allowed memory size of 698351616 bytes exhausted (tried to allocate 20480 bytes) in /srv/mediawiki/php-1.39.0-wmf.5/includes/libs/objectcache/MemcachedPeclBagOStuff.php:380

Trace:

#0 [internal function]: unknown()
#1 /srv/mediawiki/php-1.39.0-wmf.5/includes/libs/objectcache/MemcachedPeclBagOStuff.php(380): Memcached->getMulti()
#2 /srv/mediawiki/php-1.39.0-wmf.5/includes/libs/objectcache/MediumSpecificBagOStuff.php(641): MemcachedPeclBagOStuff->doGetMulti()
#3 /srv/mediawiki/php-1.39.0-wmf.5/includes/libs/objectcache/wancache/WANObjectCache.php(597): MediumSpecificBagOStuff->getMulti()
#4 /srv/mediawiki/php-1.39.0-wmf.5/includes/libs/objectcache/wancache/WANObjectCache.php(1571): WANObjectCache->fetchKeys()
#5 /srv/mediawiki/php-1.39.0-wmf.5/includes/libs/objectcache/wancache/WANObjectCache.php(1518): WANObjectCache->fetchOrRegenerate()
#6 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Preprocessor_Hash.php(126): WANObjectCache->getWithSetCallback()
#7 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(2902): Preprocessor_Hash->preprocessToObj()
#8 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(3493): Parser->preprocessToDom()
#9 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(3225): Parser->getTemplateDom()
#10 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution()
#11 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPTemplateFrame_Hash.php(160): PPFrame_Hash->expand()
#12 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPTemplateFrame_Hash.php(188): PPTemplateFrame_Hash->getNumberedArgument()
#13 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(3909): PPTemplateFrame_Hash->getArgument()
#14 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPFrame_Hash.php(293): Parser->argSubstitution()
#15 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(3023): PPFrame_Hash->expand()
#16 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution()
#17 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(3023): PPFrame_Hash->expand()
#18 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution()
#19 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(3300): PPFrame_Hash->expand()
#20 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution()
#21 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(2945): PPFrame_Hash->expand()
#22 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(1582): Parser->replaceVariables()
#23 /srv/mediawiki/php-1.39.0-wmf.5/includes/parser/Parser.php(700): Parser->internalParse()
#24 /srv/mediawiki/php-1.39.0-wmf.5/includes/content/WikitextContentHandler.php(295): Parser->parse()
#25 /srv/mediawiki/php-1.39.0-wmf.5/includes/content/ContentHandler.php(1708): WikitextContentHandler->fillParserOutput()
#26 /srv/mediawiki/php-1.39.0-wmf.5/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#27 /srv/mediawiki/php-1.39.0-wmf.5/includes/Revision/RenderedRevision.php(271): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#28 /srv/mediawiki/php-1.39.0-wmf.5/includes/Revision/RenderedRevision.php(238): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#29 /srv/mediawiki/php-1.39.0-wmf.5/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#30 /srv/mediawiki/php-1.39.0-wmf.5/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#31 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#32 /srv/mediawiki/php-1.39.0-wmf.5/includes/Revision/RenderedRevision.php(200): call_user_func()
#33 /srv/mediawiki/php-1.39.0-wmf.5/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#34 /srv/mediawiki/php-1.39.0-wmf.5/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#35 /srv/mediawiki/php-1.39.0-wmf.5/includes/page/ParserOutputAccess.php(302): PoolCounterWork->execute()
#36 /srv/mediawiki/php-1.39.0-wmf.5/includes/page/Article.php(708): MediaWiki\Page\ParserOutputAccess->getParserOutput()
#37 /srv/mediawiki/php-1.39.0-wmf.5/includes/page/Article.php(520): Article->generateContentOutput()
#38 /srv/mediawiki/php-1.39.0-wmf.5/includes/actions/ViewAction.php(80): Article->view()
#39 /srv/mediawiki/php-1.39.0-wmf.5/includes/MediaWiki.php(545): ViewAction->show()
#40 /srv/mediawiki/php-1.39.0-wmf.5/includes/MediaWiki.php(321): MediaWiki->performAction()
#41 /srv/mediawiki/php-1.39.0-wmf.5/includes/MediaWiki.php(911): MediaWiki->performRequest()
#42 /srv/mediawiki/php-1.39.0-wmf.5/includes/MediaWiki.php(565): MediaWiki->main()
#43 /srv/mediawiki/php-1.39.0-wmf.5/index.php(53): MediaWiki->run()
#44 /srv/mediawiki/php-1.39.0-wmf.5/index.php(46): wfIndexMain()
#45 /srv/mediawiki/w/index.php(3): require()
Aklapper renamed this task from Server error on https://de.wikipedia.org/wiki/Bild_(Zeitung) to Server error on https://de.wikipedia.org/wiki/Bild_(Zeitung) due to {{Auflagen-Diagramm}}.Apr 5 2022, 7:43 AM

Narrowed down the minimum wikitext from the page which is causing the memory exhaustion.

{{Auflagen-Diagramm|Zeitungen|1090|Verk|5000000}}
{{Metadaten Auflagen Zeitungen DE|1086|Verk}}
{{Metadaten Auflagen Zeitschriften DE|2378|Verk}}

I can reproduce this from https://de.wikipedia.org/wiki/Special:ExpandTemplates

  • Auflagen-Diagramm outputs a <graph>..</graph>.
  • The two Metadaten templates each produce a single integer, e.g. 641977.

As far as I can see, no regression has taken place in the infrastructure. Afaik these are as such effectively instances of T75960 or T254522, which in a nut shell: We are currently not perfect at predicting page complexity so in some cases we report a timeout or memory limit error instead of a user-friendly message that says "Page too complex". However the result is that, unless some new effficiency can be found, is that these wouldn't be supported either way. So if you care about these pages and templates (instead of caring about which error it shows), then the outcome is going to have to be either way that they become less complex.

I suspect the majority of the memory comes from the Metadaten template. Given it outputs only one number, I imagine it's one of those "database"-like templates that stores and queries a lot of data, way more than it needs, and then returns only one item. This is allowed of course, but will always have a limit. It doesn't scale and can't be supported beyond a certain size. Most likely there is a recent edit within these templates that made the dataset larger and thus now they all fail.

This is apparently a consequence of the removal of $wgMaxGeneratedPPNodeCount which was part of T204945. We need some kind of complexity or size limit on included templates. Adding @cscott.

For editors: please don't use these templates. The technical solution here is to make it produce a nicer error message, not to make it work.

aaron removed aaron as the assignee of this task.Apr 19 2022, 6:31 PM
aaron subscribed.

Change 784756 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/core@master] objectcache: optimize memory usage in WANObjectCache

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

Change 800829 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/core@master] objectcache: optimize WANObjectCache::setInterimValue() by using set()

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

Change 800829 merged by jenkins-bot:

[mediawiki/core@master] objectcache: optimize WANObjectCache::setInterimValue() by using set()

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