Page MenuHomePhabricator

InvalidArgumentException: Multiple conflicting values given for wgDiscussionToolsPageThreads
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   InvalidArgumentException: Multiple conflicting values given for wgDiscussionToolsPageThreads
error.stack_trace
from /srv/mediawiki/php-1.42.0-wmf.5/includes/parser/ParserOutput.php(1143)
#0 /srv/mediawiki/php-1.42.0-wmf.5/extensions/DiscussionTools/includes/CommentFormatter.php(365): ParserOutput->setJsConfigVar(string, array)
#1 /srv/mediawiki/php-1.42.0-wmf.5/extensions/DiscussionTools/includes/CommentFormatter.php(66): MediaWiki\Extension\DiscussionTools\CommentFormatter::addDiscussionToolsInternal(string, ParserOutput, MediaWiki\Title\Title)
#2 /srv/mediawiki/php-1.42.0-wmf.5/extensions/DiscussionTools/includes/Hooks/ParserHooks.php(69): MediaWiki\Extension\DiscussionTools\CommentFormatter::addDiscussionTools(string, ParserOutput, MediaWiki\Title\Title)
#3 /srv/mediawiki/php-1.42.0-wmf.5/extensions/DiscussionTools/includes/Hooks/ParserHooks.php(102): MediaWiki\Extension\DiscussionTools\Hooks\ParserHooks->transformHtml(ParserOutput, string, MediaWiki\Title\Title, boolean)
#4 /srv/mediawiki/php-1.42.0-wmf.5/includes/HookContainer/HookContainer.php(161): MediaWiki\Extension\DiscussionTools\Hooks\ParserHooks->onParserOutputPostCacheTransform(ParserOutput, string, array)
#5 /srv/mediawiki/php-1.42.0-wmf.5/includes/HookContainer/HookRunner.php(3027): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#6 /srv/mediawiki/php-1.42.0-wmf.5/includes/ParserOutputTransform/DefaultOutputTransform.php(119): MediaWiki\HookContainer\HookRunner->onParserOutputPostCacheTransform(ParserOutput, string, array)
#7 /srv/mediawiki/php-1.42.0-wmf.5/includes/parser/ParserOutput.php(447): Mediawiki\ParserOutputTransform\DefaultOutputTransform->transform(ParserOutput, array)
#8 /srv/mediawiki/php-1.42.0-wmf.5/includes/Output/OutputPage.php(2391): ParserOutput->getText(array)
#9 /srv/mediawiki/php-1.42.0-wmf.5/includes/Output/OutputPage.php(2435): MediaWiki\Output\OutputPage->getParserOutputText(ParserOutput, array)
#10 /srv/mediawiki/php-1.42.0-wmf.5/includes/page/Article.php(849): MediaWiki\Output\OutputPage->addParserOutput(ParserOutput, array)
#11 /srv/mediawiki/php-1.42.0-wmf.5/includes/page/Article.php(663): Article->doOutputFromParserCache(ParserOutput, MediaWiki\Output\OutputPage, array)
#12 /srv/mediawiki/php-1.42.0-wmf.5/includes/page/Article.php(559): Article->generateContentOutput(MediaWiki\User\User, ParserOptions, integer, MediaWiki\Output\OutputPage, array)
#13 /srv/mediawiki/php-1.42.0-wmf.5/includes/actions/ViewAction.php(78): Article->view()
#14 /srv/mediawiki/php-1.42.0-wmf.5/includes/MediaWiki.php(583): ViewAction->show()
#15 /srv/mediawiki/php-1.42.0-wmf.5/includes/MediaWiki.php(363): MediaWiki->performAction(Article, MediaWiki\Title\Title)
#16 /srv/mediawiki/php-1.42.0-wmf.5/includes/MediaWiki.php(960): MediaWiki->performRequest()
#17 /srv/mediawiki/php-1.42.0-wmf.5/includes/MediaWiki.php(613): MediaWiki->main()
#18 /srv/mediawiki/php-1.42.0-wmf.5/index.php(50): MediaWiki->run()
#19 /srv/mediawiki/php-1.42.0-wmf.5/index.php(46): wfIndexMain()
#20 /srv/mediawiki/w/index.php(3): require(string)
#21 {main}
Impact

100 errors in 30 min

Notes

Event Timeline

ssastry triaged this task as Medium priority.
ssastry subscribed.

These errors are from a visual diffing test run I kicked off about 45 mins back or so. DiscussionTools with Parsoid isn't used anywhere else right now. But, this gives me a clue for some diffs I was noticing in the test run. So, I'll fix this and hopefully that will fix the diffs too!

Change 975364 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/extensions/DiscussionTools@master] WIP: ParserOutputPostCacheTransform: Don't reprocess content

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

Change 975364 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] ParserOutputPostCacheTransform: Don't reprocess content

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

Change 976330 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/extensions/DiscussionTools@wmf/1.42.0-wmf.5] ParserOutputPostCacheTransform: Don't reprocess content

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

Change 976330 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.42.0-wmf.5] ParserOutputPostCacheTransform: Don't reprocess content

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

Mentioned in SAL (#wikimedia-operations) [2023-11-21T21:29:58Z] <catrope@deploy2002> Started scap: Backport for [[gerrit:976330|ParserOutputPostCacheTransform: Don't reprocess content (T351461)]]

Mentioned in SAL (#wikimedia-operations) [2023-11-21T21:31:18Z] <catrope@deploy2002> ssastry and catrope: Backport for [[gerrit:976330|ParserOutputPostCacheTransform: Don't reprocess content (T351461)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Turns out this is a different manifestation of T303015#7770480 with the ParserAfterTidy hook that triggers the DiscussionTools extension's CommentFormatter which sets the JS config var in question whenever Parsoid's pipeline processes a <templatestyles> tag (or some other extension tag that Parsoid calls core to handle). This information is accumulated and propagated to the final top level parse of the page and stored in ParserCache. Now, when Parsoid tries to get DT rendered, ParserOutput finds that the wgDiscussionToolsPageThreads has been set and barfs as above.

The problem is the same as identified in T303015#7770480 - Parsoid/PHP processes the extension tag as a "top level doc" to mimic Parsoid/JS behavior where it called the MW API.

To let us continue our testing, a temporary hack is to simply use addJsConfigVars in DT which silently overwrites any previous value for a config var (or if we want to be careful, provide an unsetJsConfigVar method in ParserOutput that DT can call for Parsoid HTML before setting it).

But, we should probably revisit the 'parseExtTagAsTopLevelDoc' implementation in Parser.php -- maybe we don't need to run the two hooks (ParserAfterParse and ParserAfterTidy) for every extension anymore! Since any extension that relies on those hooks will need a Parsoid-equivalent implementation to work properly with Parsoid, that implementation will process the full top-level doc anyway. But, this is a potentially intrusive change and something we should carefully audit before rolling out.

Change 977310 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/extensions/DiscussionTools@master] Work around Parsoid's messy handling of some extensions

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

Change 978067 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/extensions/DiscussionTools@wmf/1.42.0-wmf.7] Work around Parsoid's messy handling of some extensions

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

Change 977310 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Work around Parsoid's messy handling of some extensions

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

Change 978067 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.42.0-wmf.7] Work around Parsoid's messy handling of some extensions

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

Mentioned in SAL (#wikimedia-operations) [2023-11-28T21:59:26Z] <urbanecm@deploy2002> Started scap: Backport for [[gerrit:978072|Fixes: Duplicate events for radio buttons (T352075)]], [[gerrit:978071|Fixes: Duplicate events for radio buttons (T352075)]], [[gerrit:978067|Work around Parsoid's messy handling of some extensions (T351461)]]

Mentioned in SAL (#wikimedia-operations) [2023-11-28T22:01:04Z] <urbanecm@deploy2002> urbanecm and ssastry and jdlrobson: Backport for [[gerrit:978072|Fixes: Duplicate events for radio buttons (T352075)]], [[gerrit:978071|Fixes: Duplicate events for radio buttons (T352075)]], [[gerrit:978067|Work around Parsoid's messy handling of some extensions (T351461)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2023-11-28T22:12:29Z] <urbanecm@deploy2002> Finished scap: Backport for [[gerrit:978072|Fixes: Duplicate events for radio buttons (T352075)]], [[gerrit:978071|Fixes: Duplicate events for radio buttons (T352075)]], [[gerrit:978067|Work around Parsoid's messy handling of some extensions (T351461)]] (duration: 13m 02s)