Page MenuHomePhabricator

AbuseFilter "Examine past edits" feature opens master conn on GET in certain cases involving Scribunto
Closed, ResolvedPublic

Description

Not sure what's going on here exactly, but you can trigger it by going to https://en.wikipedia.org/wiki/Special:AbuseFilter/examine/log/3690337 . Judging from frame #3 (WikiPage.php line 2158), maybe it's caused by {{REVISIONID}} being used on the page or by Lua code?

Expectation (masterConns <= 0) by MediaWiki::main not met:
[connect to 10.64.32.27 (enwiki)]
#0 /srv/mediawiki/php-1.29.0-wmf.6/includes/libs/rdbms/TransactionProfiler.php(160): TransactionProfiler->reportExpectationViolated()
#1 /srv/mediawiki/php-1.29.0-wmf.6/includes/libs/rdbms/loadbalancer/LoadBalancer.php(587): TransactionProfiler->recordConnection()
#2 /srv/mediawiki/php-1.29.0-wmf.6/includes/GlobalFunctions.php(3077): LoadBalancer->getConnection()
#3 /srv/mediawiki/php-1.29.0-wmf.6/includes/page/WikiPage.php(2158): wfGetDB()
#4 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(2628): Closure$WikiPage::prepareContentForEdit#2()
#5 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(3065): Parser->getVariableValue()
#6 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Preprocessor_Hash.php(1015): Parser->braceSubstitution()
#7 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(841): PPFrame_Hash->expand()
#8 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(792): Scribunto_LuaEngine->doCachedExpansion()
#9 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/engines/LuaSandbox/Engine.php(397): Scribunto_LuaEngine->preprocess()
#10 (): Scribunto_LuaSandboxCallback->__call()
#11 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/engines/LuaSandbox/Engine.php(329): LuaSandboxFunction->call()
#12 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(266): Scribunto_LuaSandboxInterpreter->callFunction()
#13 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(914): Scribunto_LuaEngine->executeFunctionChunk()
#14 /srv/mediawiki/php-1.29.0-wmf.6/extensions/Scribunto/common/Hooks.php(116): Scribunto_LuaModule->invoke()
#15 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(3379): ScribuntoHooks::invokeHook()
#16 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(3103): Parser->callParserFunction()
#17 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Preprocessor_Hash.php(1015): Parser->braceSubstitution()
#18 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(3256): PPFrame_Hash->expand()
#19 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Preprocessor_Hash.php(1015): Parser->braceSubstitution()
#20 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(2917): PPFrame_Hash->expand()
#21 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(1265): Parser->replaceVariables()
#22 /srv/mediawiki/php-1.29.0-wmf.6/includes/parser/Parser.php(441): Parser->internalParse()
#23 /srv/mediawiki/php-1.29.0-wmf.6/includes/content/WikitextContent.php(330): Parser->parse()
#24 /srv/mediawiki/php-1.29.0-wmf.6/includes/content/AbstractContent.php(497): WikitextContent->fillParserOutput()
#25 /srv/mediawiki/php-1.29.0-wmf.6/includes/page/WikiPage.php(2167): AbstractContent->getParserOutput()
#26 /srv/mediawiki/php-1.29.0-wmf.6/includes/page/Article.php(2399): WikiPage->prepareContentForEdit()
#27 /srv/mediawiki/php-1.29.0-wmf.6/extensions/AbuseFilter/AbuseFilterVariableHolder.php(413): Article->prepareContentForEdit()
#28 /srv/mediawiki/php-1.29.0-wmf.6/extensions/AbuseFilter/AbuseFilterVariableHolder.php(45): AFComputedVariable->compute()
#29 /srv/mediawiki/php-1.29.0-wmf.6/extensions/AbuseFilter/AbuseFilterVariableHolder.php(184): AbuseFilterVariableHolder->getVar()
#30 /srv/mediawiki/php-1.29.0-wmf.6/extensions/AbuseFilter/Views/AbuseFilterViewExamine.php(120): AbuseFilterVariableHolder->dumpAllVars()
#31 /srv/mediawiki/php-1.29.0-wmf.6/extensions/AbuseFilter/Views/AbuseFilterViewExamine.php(24): AbuseFilterViewExamine->showExaminerForLogEntry()
#32 /srv/mediawiki/php-1.29.0-wmf.6/extensions/AbuseFilter/special/SpecialAbuseFilter.php(115): AbuseFilterViewExamine->show()
#33 /srv/mediawiki/php-1.29.0-wmf.6/includes/specialpage/SpecialPage.php(522): SpecialAbuseFilter->execute()
#34 /srv/mediawiki/php-1.29.0-wmf.6/includes/specialpage/SpecialPageFactory.php(577): SpecialPage->run()
#35 /srv/mediawiki/php-1.29.0-wmf.6/includes/MediaWiki.php(283): SpecialPageFactory::executePath()
#36 /srv/mediawiki/php-1.29.0-wmf.6/includes/MediaWiki.php(851): MediaWiki->performRequest()
#37 /srv/mediawiki/php-1.29.0-wmf.6/includes/MediaWiki.php(512): MediaWiki->main()
#38 /srv/mediawiki/php-1.29.0-wmf.6/index.php(43): MediaWiki->run()
#39 /srv/mediawiki/w/index.php(3): include()
#40 {main}

Event Timeline

Catrope created this task.Jan 4 2017, 1:41 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 4 2017, 1:41 AM
Anomie added a subscriber: Anomie.

maybe it's caused by {{REVISIONID}} being used on the page or by Lua code?

Seems pretty likely considering the preprocess() call in frame #9. Might be Module:Check for unknown parameters, for example, which uses frame:preprocess( "{{REVISIONID}}" ) as a hack to detect "preview mode" as described in T137900.

Removing MediaWiki-extensions-Scribunto since there's nothing Scribunto can sanely do about this.

Anomie removed a subscriber: Anomie.Jan 4 2017, 4:27 AM

Change 330466 had a related patch set uploaded (by Aaron Schulz):
Avoid master queries when old filter checks are viewed

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

Change 330466 abandoned by Aaron Schulz:
Avoid master queries when old filter checks are viewed

Reason:
Makes sense

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

Change 332891 had a related patch set uploaded (by Aaron Schulz):
Avoid master queries when old filter checks are viewed

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

Change 332891 merged by jenkins-bot:
Avoid master queries when old filter checks are viewed

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

matej_suchanek moved this task from Backlog to Internal bugs on the AbuseFilter board.
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptJul 31 2017, 7:46 PM
tstarling closed this task as Resolved.Feb 21 2018, 3:19 AM
tstarling claimed this task.
tstarling added a subscriber: tstarling.

Seems fixed.