Argument 1 passed to Wikimedia\Parsoid\Utils\DOMDataUtils::getDataMw() must be an instance of DOMElement
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.2

message
Argument 1 passed to Wikimedia\Parsoid\Utils\DOMDataUtils::getDataMw() must be an instance of DOMElement, null given, called in /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/PP/Handlers/HandleLinkNeighbours.php on line 225

Impact

Saw about 190 of these in logs after deploying 1.36.0-wmf.2 to group2, all on euwiki, ruwiki, and fiwiki.

Details

Request ID
27cc2644-5529-4ef9-8765-77872dd03c64
Request URL
https://eu.wikipedia.org/w/rest.php/eu.wikipedia.org/v3/page/pagebundle/Lari/7708304
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/PP/Handlers/HandleLinkNeighbours.php(225): Wikimedia\Parsoid\Utils\DOMDataUtils::getDataMw(NULL)
#1 [internal function]: Wikimedia\Parsoid\Wt2Html\PP\Handlers\HandleLinkNeighbours::handler(DOMElement, Wikimedia\Parsoid\Config\Env, array, boolean, NULL)
#2 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Utils/DOMTraverser.php(78): call_user_func(array, DOMElement, Wikimedia\Parsoid\Config\Env, array, boolean, NULL)
#3 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Utils/DOMTraverser.php(147): Wikimedia\Parsoid\Utils\DOMTraverser->callHandlers(DOMElement, Wikimedia\Parsoid\Config\Env, array, boolean, NULL)
#4 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Utils/DOMTraverser.php(159): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Wikimedia\Parsoid\Config\Env, DOMElement, array, boolean, NULL)
#5 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Utils/DOMTraverser.php(159): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Wikimedia\Parsoid\Config\Env, DOMElement, array, boolean, NULL)
#6 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(147): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Wikimedia\Parsoid\Config\Env, DOMElement, array, boolean, NULL)
#7 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(847): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(DOMElement, array, boolean)
#8 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(896): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->doPostProcess(DOMDocument)
#9 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(913): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->process(DOMDocument)
#10 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(152): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#11 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(202): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#12 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseToplevelDoc(string, array)
#13 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Core/WikitextContentModelHandler.php(78): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#14 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Parsoid.php(152): Wikimedia\Parsoid\Core\WikitextContentModelHandler->toDOM(Wikimedia\Parsoid\Config\Env)
#15 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/src/Parsoid.php(184): Wikimedia\Parsoid\Parsoid->parseWikitext(MWParsoid\Config\PageConfig, array)
#16 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php(568): Wikimedia\Parsoid\Parsoid->wikitext2html(MWParsoid\Config\PageConfig, array, NULL)
#17 /srv/mediawiki/php-1.36.0-wmf.2/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php(90): MWParsoid\Rest\Handler\ParsoidHandler->wt2html(MWParsoid\Config\PageConfig, array)
#18 /srv/mediawiki/php-1.36.0-wmf.2/includes/Rest/Router.php(365): MWParsoid\Rest\Handler\PageHandler->execute()
#19 /srv/mediawiki/php-1.36.0-wmf.2/includes/Rest/Router.php(320): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#20 /srv/mediawiki/php-1.36.0-wmf.2/includes/Rest/EntryPoint.php(133): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#21 /srv/mediawiki/php-1.36.0-wmf.2/includes/Rest/EntryPoint.php(100): MediaWiki\Rest\EntryPoint->execute()
#22 /srv/mediawiki/php-1.36.0-wmf.2/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#23 /srv/mediawiki/w/rest.php(3): require(string)
#24 {main}

Event Timeline

brennen triaged this task as Unbreak Now! priority.Jul 30 2020, 10:23 PM
brennen moved this task from Backlog to Logs/Train on the User-brennen board.
brennen moved this task from Untriaged to Jul 2020 on the Wikimedia-production-error board.

Culprit is almost certainly 73699afc923d9ba128bf0e0388cf64cbf4c4d688 or b695a717fdecb49ffdc0f1e277246ab1d043153c. @ssastry is on vacation this week, but we should be able to patch it so it doesn't crash at least.

Change 617553 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/services/parsoid@master] WIP: Hack to prevent HandleLinkNeighbors crasher in production

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

Ok, can reproduce, and confirmed that above patch fixes the issue:

$ php bin/parse.php --restURL https://eu.wikipedia.org/w/rest.php/eu.wikipedia.org/v3/page/pagebundle/Lari/7708304 
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Wikimedia\Parsoid\Utils\DOMDataUtils::getDataMw() must be an instance of DOMElement, null given, called in /home/cananian/Projects/Wikimedia/Parsoid/src/Wt2Html/PP/Handlers/HandleLinkNeighbours.php on line 225 and defined in /home/cananian/Projects/Wikimedia/Parsoid/src/Utils/DOMDataUtils.php:148
Stack trace:
#0 /home/cananian/Projects/Wikimedia/Parsoid/src/Wt2Html/PP/Handlers/HandleLinkNeighbours.php(225): Wikimedia\Parsoid\Utils\DOMDataUtils::getDataMw(NULL)
#1 [internal function]: Wikimedia\Parsoid\Wt2Html\PP\Handlers\HandleLinkNeighbours::handler(Object(DOMElement), Object(Wikimedia\Parsoid\Config\Env), Array, true, NULL)
#2 /home/cananian/Projects/Wikimedia/Parsoid/src/Utils/DOMTraverser.php(79): call_user_func(Array, Object(DOMElement), Object(Wikimedia\Parsoid\Config\Env), Array, true, NULL)
#3 /home/cananian/Projects/Wikimedia/Parsoid/src/Utils/DOMTraverser.php(148): Wikimedia\Parsoid\Utils\DOMTraverser->callHandlers(Object(DOMElement), Object(Wikimedia\Parsoid in /home/cananian/Projects/Wikimedia/Parsoid/src/Utils/DOMDataUtils.php on line 148
cananian@skiffserv:~/Projects/Wikimedia/Parsoid$ git rebase --continue
Successfully rebased and updated refs/heads/review/c_scott_ananian/T259311.
cananian@skiffserv:~/Projects/Wikimedia/Parsoid$ php bin/parse.php --restURL https://eu.wikipedia.org/w/rest.php/eu.wikipedia.org/v3/page/pagebundle/Lari/7708304 
[...success...]

To do (help appreciated): isolate a minimal test case from the above crash, land the patch, branch v0.13.0-a2 and cherry-pick the patch, rt-test the branch, release v0.13.0-a3 on the branch, write a mediawiki-vendor patch for wmf.2 which bumps to v0.13.0-a3.

To do (help appreciated): isolate a minimal test case from the above crash, land the patch, branch v0.13.0-a2 and cherry-pick the patch, rt-test the branch, release v0.13.0-a3 on the branch, write a mediawiki-vendor patch for wmf.2 which bumps to v0.13.0-a3.

If it's just a one line fix, I would suggest just patching the file mediawiki/vendor directly and cherry-picking & backporting that to wmf.2 instead of going through all the hassle of making a release just for the production backport.

Change 617597 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Fix incorrect computation of 'inTpl' predicate in HandleLinkNeighbours

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

To do (help appreciated): isolate a minimal test case from the above crash, land the patch, branch v0.13.0-a2 and cherry-pick the patch, rt-test the branch, release v0.13.0-a3 on the branch, write a mediawiki-vendor patch for wmf.2 which bumps to v0.13.0-a3.

If it's just a one line fix, I would suggest just patching the file mediawiki/vendor directly and cherry-picking & backporting that to wmf.2 instead of going through all the hassle of making a release just for the production backport.

2-line fix now but this works for me.

I'd still like to rt-test the patch, since we've got the time and aren't under the gun. Although I could cherry-pick the patch to selenium for rt-testing as well, I think I'm going to do things "right" and make a branch & tag it. We'll call this a dress rehearsal for how we'd handle a more significant backport.

Change 617553 abandoned by C. Scott Ananian:
[mediawiki/services/parsoid@master] WIP: Hack to prevent HandleLinkNeighbors crasher in production

Reason:
In favor of subbu's fix in Ie60d2beda57d1ef16cac5945f0a0afadbabfa5d0

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

Change 617597 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Fix incorrect computation of 'inTpl' predicate in HandleLinkNeighbours

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

Change 617719 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/vendor@master] Bump wikimedia/parsoid to v0.13.0-a3

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

The patch is written and merged in Parsoid, it looks good. I kicked off an rt-testing run, and it's gotten through ~60k articles without any apparently problems. I'm going to go ahead and let it finish the full ~160k test run and review it before I/we merge https://gerrit.wikimedia.org/r/617719 into mediawiki-vendor. Once we do that, it should be straightforward to cherry-pick for wmf.2.

If there were time pressure, it would be fine to merge 617719 right away and cherry pick it, but since we have until Monday before the train resumes, I'm going to wait and Do Things Right.

Change 617719 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to v0.13.0-a3

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

Change 618068 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/vendor@wmf/1.36.0-wmf.2] Bump wikimedia/parsoid to v0.13.0-a3

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

ssastry claimed this task.
ssastry lowered the priority of this task from Unbreak Now! to High.

Lowering priority since the train rolled out without this fix, it appears. I'm also going to resolve this since the bug is fixed in master and it will roll out as part of wmf.3.

Change 618068 abandoned by Subramanya Sastry:
[mediawiki/vendor@wmf/1.36.0-wmf.2] Bump wikimedia/parsoid to v0.13.0-a3

Reason:
As per discussion.

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

Change 618166 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/vendor@master] Bump wikimedia/parsoid to v0.13.0-a4

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

Change 618038 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/vendor@wmf/1.36.0-wmf.3] Bump wikimedia/parsoid to v0.13.0-a4

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

Change 618166 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to v0.13.0-a4

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

Change 618038 merged by jenkins-bot:
[mediawiki/vendor@wmf/1.36.0-wmf.3] Bump wikimedia/parsoid to v0.13.0-a4

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