Page MenuHomePhabricator

Argument 1 passed to Parsoid\Wt2Html\TT\OnlyInclude::onTag() must be an instance of Parsoid\Tokens\Token, array given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

message
Argument 1 passed to Parsoid\Wt2Html\TT\OnlyInclude::onTag() must be an instance of Parsoid\Tokens\Token, array given, called in /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/TT/TokenHandler.php on line 211

Details

Request ID
Xcgk0wpAMEsAAB78k9EAAAAY
Request URL
https://en.wikipedia.org/w/rest.php/en.wikipedia.org/v3/page/pagebundle/User_talk%3A73.165.23.130/636369409
Stack Trace
exception.trace
#0 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/TT/TokenHandler.php(211): Parsoid\Wt2Html\TT\OnlyInclude->onTag(array)
#1 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/TokenTransformManager.php(120): Parsoid\Wt2Html\TT\TokenHandler->process(array)
#2 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/TokenTransformManager.php(192): Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#3 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/TokenTransformManager.php(190): Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#4 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/TokenTransformManager.php(190): Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#5 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/HTML5TreeBuilder.php(430): Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#6 [internal function]: Parsoid\Wt2Html\HTML5TreeBuilder->processChunkily(string, array)
#7 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/DOMPostProcessor.php(894): Generator->current()
#8 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/ParserPipeline.php(148): Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#9 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/ParserPipeline.php(198): Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#10 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Wt2Html/ParserPipelineFactory.php(299): Parsoid\Wt2Html\ParserPipeline->parseToplevelDoc(string, array)
#11 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/WikitextContentModelHandler.php(78): Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#12 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Parsoid.php(86): Parsoid\WikitextContentModelHandler->toHTML(Parsoid\Config\Env)
#13 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/src/Parsoid.php(113): Parsoid\Parsoid->parseWikitext(MWParsoid\Config\PageConfig, array)
#14 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/extension/src/Rest/Handler/ParsoidHandler.php(564): Parsoid\Parsoid->wikitext2html(MWParsoid\Config\PageConfig, array, NULL)
#15 /srv/deployment/parsoid/deploy-cache/revs/c6a457fbfdc7b0a5d0fbd6dd146a3ca23ad8bea5/src/extension/src/Rest/Handler/PageHandler.php(52): MWParsoid\Rest\Handler\ParsoidHandler->wt2html(Parsoid\Config\Env, array)
#16 /srv/mediawiki/php-1.35.0-wmf.5/includes/Rest/Router.php(315): MWParsoid\Rest\Handler\PageHandler->execute()
#17 /srv/mediawiki/php-1.35.0-wmf.5/includes/Rest/Router.php(285): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#18 /srv/mediawiki/php-1.35.0-wmf.5/includes/Rest/EntryPoint.php(116): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#19 /srv/mediawiki/php-1.35.0-wmf.5/includes/Rest/EntryPoint.php(83): MediaWiki\Rest\EntryPoint->execute()
#20 /srv/mediawiki/php-1.35.0-wmf.5/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#21 /srv/mediawiki/w/rest.php(3): require(string)
#22 {main}

Event Timeline

ssastry triaged this task as Medium priority.Nov 20 2019, 6:15 PM

Change 554648 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Fix flattening empty arrays

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

The above patch resolves this error but the example page now hits a maximum execution time error despite its small size. Same is true on Parsoid/JS. I wonder what's going on there ...

Change 554648 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Fix flattening empty arrays

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

The above patch resolves this error but the example page now hits a maximum execution time error despite its small size. Same is true on Parsoid/JS. I wonder what's going on there ...

I put a debugger; statement here,
https://github.com/wikimedia/parsoid/blob/master/lib/wt2html/tokenizer.js#L326

and in the chunkCB and after the first two chunks are emitted (which is empty arrays) the iterator seems to go into an infinite loop. Tomorrow I'll look into why it isn't making any progress.

The page seems to start with a carriage return (0d), which throws Parsoids into a loop.

> node tools/fetch-wt.js --domain en.wikipedia.org --title "User talk:73.165.23.130" | hexdump -C
00000000  0d 3d 3d 20 44 65 63 65  6d 62 65 72 20 32 30 31  |.== December 201|
00000010  34 20 3d 3d 0d 5b 5b 46  69 6c 65 3a 49 6e 66 6f  |4 ==.[[File:Info|

T237306 is a similar case, where \r is found is stray position (before "titre"),

> node tools/fetch-wt.js --domain fr.wikipedia.org --title "Utilisateur:Swirl/Modèles/Musique" | hexdump -C
00000000  7b 7b 49 6e 66 6f 62 6f  78 20 4d 75 73 69 71 75  |{{Infobox Musiqu|
00000010  65 20 28 c5 93 75 76 72  65 29 0a 20 7c 20 63 68  |e (..uvre). | ch|
00000020  61 72 74 65 20 3d 20 61  6c 62 75 6d 7c 0d 74 69  |arte = album|.ti|
00000030  74 72 65 3d 54 69 74 72  65 7c 0a 69 6d 61 67 65  |tre=Titre|.image|

and, indeed, the following patch can turn the loop above into the Expected end of input or tlb but "\r" found. error from over there.

diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 7eb19f9cc..48507b055 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -377,7 +377,7 @@ block
     // Inlineline includes generic tags; wrapped into paragraphs in token
     // transform and DOM postprocessor
     / inlineline
-    / s:sol !inline_breaks { return s; }
+    / s:sol !sof !inline_breaks { return s; }

Change 555596 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Handle stray "\r" in inlineline position

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

Change 555596 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Handle stray "\r" in inlineline position

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