Page MenuHomePhabricator

MW 1.41 parser locked error when using languages with grammatical gender
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue:

  • Installed MediaWiki 1.41.1 on a server.
  • Vector skin, MySQL database.
  • Installation language: ES.
  • Make sure the installation works OK.
  • Install Auth_remoteuser (for release 1.41).

What happens?:

Installation crashes. You can see top bar (with correct logged user) and left sidebar. But content area shows internal error (stack trace included later).

Further steps:

  • Removing the extension, installation works fine.
  • Instead, changing language to EN causes installation to work perfectly.
  • Returning to ES it crashes again.

Some languages tried:

  • ES and FR crash.
  • EN, IT, RU work fine.

All the tried languages work fine if the extension is removed.

Software version:

MediaWiki 1.41.1.

Other information:

See stack trace following:

/wiki/Pagina_principal MWException: Parser state cleared while parsing.
Did you call Parser::parse recursively? Lock is held by:
#0 /aplicaciones/dp08/dp08_bcnwiki/includes/parser/Parser.php(882): Parser->lock()
#1 /aplicaciones/dp08/dp08_bcnwiki/includes/parser/Parser.php(4821): Parser->preprocess()
#2 /aplicaciones/dp08/dp08_bcnwiki/includes/language/MessageCache.php(1442): Parser->transformMsg()
#3 /aplicaciones/dp08/dp08_bcnwiki/includes/language/Message.php(1464): MessageCache->transform()
#4 /aplicaciones/dp08/dp08_bcnwiki/includes/language/Message.php(1011): Message->transformText()
#5 /aplicaciones/dp08/dp08_bcnwiki/includes/language/Message.php(1059): Message->format()
#6 /aplicaciones/dp08/dp08_bcnwiki/includes/linker/Linker.php(2207): Message->text()
#7 /aplicaciones/dp08/dp08_bcnwiki/includes/linker/Linker.php(2388): MediaWiki\Linker\Linker::titleAttrib()
#8 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentLink.php(236): MediaWiki\Linker\Linker::tooltipAndAccesskeyAttribs()
#9 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentLink.php(183): MediaWiki\Skin\SkinComponentLink->applyLinkTitleAttribs()
#10 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentLink.php(254): MediaWiki\Skin\SkinComponentLink->makeLink()
#11 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentListItem.php(138): MediaWiki\Skin\SkinComponentLink->getTemplateData()
#12 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentListItem.php(221): MediaWiki\Skin\SkinComponentListItem->makeListItem()
#13 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentMenu.php(166): MediaWiki\Skin\SkinComponentListItem->getTemplateData()
#14 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/Skin.php(2470): MediaWiki\Skin\SkinComponentMenu->getTemplateData()
#15 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinTemplate.php(641): Skin->getPortletData()
#16 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinTemplate.php(181): SkinTemplate->getPortletsTemplateData()
#17 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinMustache.php(125): SkinTemplate->getTemplateData()
#18 /aplicaciones/dp08/dp08_bcnwiki/skins/Vector/includes/SkinVectorLegacy.php(161): SkinMustache->getTemplateData()
#19 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinMustache.php(92): MediaWiki\Skins\Vector\SkinVectorLegacy->getTemplateData()
#20 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinTemplate.php(174): SkinMustache->generateHTML()
#21 /aplicaciones/dp08/dp08_bcnwiki/includes/Output/OutputPage.php(2947): SkinTemplate->outputPage()
#22 /aplicaciones/dp08/dp08_bcnwiki/includes/MediaWiki.php(978): MediaWiki\Output\OutputPage->output()
#23 /aplicaciones/dp08/dp08_bcnwiki/includes/MediaWiki.php(613): MediaWiki->main()
#24 /aplicaciones/dp08/dp08_bcnwiki/index.php(50): MediaWiki->run()
#25 /aplicaciones/dp08/dp08_bcnwiki/index.php(46): wfIndexMain()
#26 {main}

Backtrace:

from /aplicaciones/dp08/dp08_bcnwiki/includes/parser/Parser.php(6309)
#0 /aplicaciones/dp08/dp08_bcnwiki/includes/parser/Parser.php(882): Parser->lock()
#1 /aplicaciones/dp08/dp08_bcnwiki/includes/parser/Parser.php(4821): Parser->preprocess()
#2 /aplicaciones/dp08/dp08_bcnwiki/includes/language/MessageCache.php(1442): Parser->transformMsg()
#3 /aplicaciones/dp08/dp08_bcnwiki/includes/language/Message.php(1464): MessageCache->transform()
#4 /aplicaciones/dp08/dp08_bcnwiki/includes/language/Message.php(1011): Message->transformText()
#5 /aplicaciones/dp08/dp08_bcnwiki/includes/language/Message.php(1059): Message->format()
#6 /aplicaciones/dp08/dp08_bcnwiki/includes/linker/Linker.php(2207): Message->text()
#7 /aplicaciones/dp08/dp08_bcnwiki/includes/linker/Linker.php(2388): MediaWiki\Linker\Linker::titleAttrib()
#8 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentLink.php(236): MediaWiki\Linker\Linker::tooltipAndAccesskeyAttribs()
#9 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentLink.php(183): MediaWiki\Skin\SkinComponentLink->applyLinkTitleAttribs()
#10 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentLink.php(254): MediaWiki\Skin\SkinComponentLink->makeLink()
#11 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentListItem.php(138): MediaWiki\Skin\SkinComponentLink->getTemplateData()
#12 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentListItem.php(221): MediaWiki\Skin\SkinComponentListItem->makeListItem()
#13 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/components/SkinComponentMenu.php(166): MediaWiki\Skin\SkinComponentListItem->getTemplateData()
#14 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/Skin.php(2470): MediaWiki\Skin\SkinComponentMenu->getTemplateData()
#15 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinTemplate.php(641): Skin->getPortletData()
#16 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinTemplate.php(181): SkinTemplate->getPortletsTemplateData()
#17 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinMustache.php(125): SkinTemplate->getTemplateData()
#18 /aplicaciones/dp08/dp08_bcnwiki/skins/Vector/includes/SkinVectorLegacy.php(161): SkinMustache->getTemplateData()
#19 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinMustache.php(92): MediaWiki\Skins\Vector\SkinVectorLegacy->getTemplateData()
#20 /aplicaciones/dp08/dp08_bcnwiki/includes/skins/SkinTemplate.php(174): SkinMustache->generateHTML()
#21 /aplicaciones/dp08/dp08_bcnwiki/includes/Output/OutputPage.php(2947): SkinTemplate->outputPage()
#22 /aplicaciones/dp08/dp08_bcnwiki/includes/MediaWiki.php(978): MediaWiki\Output\OutputPage->output()
#23 /aplicaciones/dp08/dp08_bcnwiki/includes/MediaWiki.php(613): MediaWiki->main()
#24 /aplicaciones/dp08/dp08_bcnwiki/index.php(50): MediaWiki->run()
#25 /aplicaciones/dp08/dp08_bcnwiki/index.php(46): wfIndexMain()
#26 {main}

Support desk links:

Event Timeline

It would be nice to know which exact translated message creates this problem but not sure how to do that - maybe a question for https://www.mediawiki.org/wiki/Project:Support_desk

This is not an issue to fix in any code of the extension itself as there is not a single call in the extension codebase itself listed.

I have just reported it in Support desk also.

There is only 1 translation message and it's pretty similar to the English translation, so I doubt that is it.

The only thing that really stands out, is that this extension does a somewhat unconventional method of registering and running of several hooks. It does this straight from the session provider, directly going to the hook container and registration static anonymous functions. Kinda difficult to determine if that is safe or not..

There are several other similar reports on Project:Support_desk, most of them saying it happens with no extensions just core mediawiki. All of them saying they are using MW 1.41.1

It would be nice to know which exact translated message creates this problem but not sure how to do that

One of the posts on support desk seem to indicate that the message is tooltip-pt-userpage

ES and FR crash.
EN, IT, RU work fine.

It should be noted that ES and FR have gender differences for the tooltip-pt-userpage, where EN, IT, and RU use the same text regardless of user gender.

The logic has a short cut for the case where there is only one gender form like EN, IT and RU, so the issue is somewhere in the gender code probably.


When parsing {{GENDER:...}} in a message where there is more than one argument to {{GENDER:..}}, eventually this will call GenderCache::getGenderOf which will call RequestContext::getMain()->getUser()->getName() which will call User::newFromSession (maybe). Eventually this will call SessionHandler stuff.

So plausible theory is that auth_remoteuser tries to parse something via SessionHandler code, causing problems.

However, MessageCache::transform & MessageCache::parse() has a check for $this->inParser() which is supposed to prevent that 🤷.

Another possibility, is thatMessageCache::getParserOptions() triggers RequestContext::getMain()->getUser(), which somehow triggers another message parse. Since all this happens before $this->isInParse is set, the MessageCache guard code wouldn't trigger.

Also, for reference, i tried to reproduce this, by installing 1.41.1 tarball, and doing wfLoadExtension( 'Auth_remoteuser' );$wgAuthRemoteuserUserName = "Everybody";, but i wasn't able to reproduce.

Given some people on support desk are also reporting this even with no extensions, i think there is still some sort of factor missing that triggers this issue.

Bawolff renamed this task from Extension crashes with certain languages to MW 1.41 parser locked error when using languages with grammatical gender.Mon, Jun 10, 6:51 PM
Bawolff added a project: MW-1.41-release.

I've just started all over again, but this time using the MediaWiki LTS version (1.39.7).

The problem is exactly the same.

Maybe it depends on the configured cache layers ? SQL vs file vs memcached.

If people can share what cache settings they have in their LocalSettings.php, that could provide a hint ?

When I had no cache at all it crashed. After adding Main cache, it crashed also.