Page MenuHomePhabricator

"PHP fatal error: entire web request took longer than 60 seconds and timed out" on zh.wikisource page
Closed, ResolvedPublic

Description

see https://zh.wikisource.org/wiki/%E4%B8%AD%E5%9B%BD%EF%BC%8D%E4%B8%9C%E7%9B%9F%E8%87%AA%E7%94%B1%E8%B4%B8%E6%98%93%E5%8C%BA%E7%A8%8E%E7%9B%AE%E7%A8%8E%E7%8E%87%E8%A1%A8

PHP fatal error:
entire web request took longer than 60 seconds and timed out

The page size is 1,886,598 byte

Event Timeline

Shizhao created this task.May 21 2019, 9:52 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 21 2019, 9:52 AM
Aklapper renamed this task from Page load timed out to "PHP fatal error: entire web request took longer than 60 seconds and timed out" on zh.wikisource page.May 21 2019, 12:11 PM
#0 /srv/mediawiki/php-1.34.0-wmf.5/languages/LanguageConverter.php(429): NO_FUNCTION_GIVEN()
#1 /srv/mediawiki/php-1.34.0-wmf.5/languages/LanguageConverter.php(735): LanguageConverter->autoConvert(string, string)
#2 /srv/mediawiki/php-1.34.0-wmf.5/languages/LanguageConverter.php(699): LanguageConverter->recursiveConvertTopLevel(string, string)
#3 /srv/mediawiki/php-1.34.0-wmf.5/languages/LanguageConverter.php(680): LanguageConverter->convertTo(string, string)
#4 /srv/mediawiki/php-1.34.0-wmf.5/languages/Language.php(4184): LanguageConverter->convert(string)
#5 /srv/mediawiki/php-1.34.0-wmf.5/includes/parser/Parser.php(1438): Language->convert(string)
#6 /srv/mediawiki/php-1.34.0-wmf.5/includes/parser/Parser.php(494): Parser->internalParseHalfParsed(string, boolean, boolean)
#7 /srv/mediawiki/php-1.34.0-wmf.5/includes/content/WikitextContent.php(365): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#8 /srv/mediawiki/php-1.34.0-wmf.5/includes/content/AbstractContent.php(555): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#9 /srv/mediawiki/php-1.34.0-wmf.5/includes/Revision/RenderedRevision.php(266): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#10 /srv/mediawiki/php-1.34.0-wmf.5/includes/Revision/RenderedRevision.php(234): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#11 /srv/mediawiki/php-1.34.0-wmf.5/includes/Revision/RevisionRenderer.php(193): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string)
#12 /srv/mediawiki/php-1.34.0-wmf.5/includes/Revision/RevisionRenderer.php(142): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#13 [internal function]: Closure$MediaWiki\Revision\RevisionRenderer::getRenderedRevision#2(MediaWiki\Revision\RenderedRevision, array)
#14 /srv/mediawiki/php-1.34.0-wmf.5/includes/Revision/RenderedRevision.php(197): call_user_func(Closure$MediaWiki\Revision\RevisionRenderer::getRenderedRevision#2;1090, MediaWiki\Revision\RenderedRevision, array)
#15 /srv/mediawiki/php-1.34.0-wmf.5/includes/poolcounter/PoolWorkArticleView.php(196): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#16 /srv/mediawiki/php-1.34.0-wmf.5/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#17 /srv/mediawiki/php-1.34.0-wmf.5/includes/page/Article.php(773): PoolCounterWork->execute()
#18 /srv/mediawiki/php-1.34.0-wmf.5/includes/actions/ViewAction.php(68): Article->view()
#19 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(499): ViewAction->show()
#20 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#21 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(865): MediaWiki->performRequest()
#22 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(515): MediaWiki->main()
#23 /srv/mediawiki/php-1.34.0-wmf.5/index.php(42): MediaWiki->run()
#24 /srv/mediawiki/w/index.php(3): include(string)
#25 {main}
Wang_Qiliang triaged this task as Unbreak Now! priority.Jun 9 2019, 12:31 PM
Wang_Qiliang added a subscriber: Wang_Qiliang.

It seems that this problem is not solved since May 24. Is there anyone help?

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptJun 9 2019, 12:31 PM
94rain added a subscriber: 94rain.Jun 9 2019, 12:42 PM
Aklapper lowered the priority of this task from Unbreak Now! to Needs Triage.Jun 9 2019, 1:07 PM

If the number of people affected is too much, the priority should be High.

Before we have a fundamental solution, you can split the page content via the API.

cscott added a subscriber: cscott.Jul 2 2019, 5:22 PM

Wikitext source, for reference:

(I think this has an extra trailing newline appended, if it matters)

The page is larger than Parsoid's default page size and table cell count limits.

-------------------- Used resources -------------------
                      # tokens: 636831 / 1000000
                   # listItems: 0 / 30000
                  # tableCells: 75269 / 100000
               # transclusions: 0 / 10000
                      # images: 0 / 1000
                  wikitextSize: 1764512 / 2000000
                     HTML Size: 15398053
-------------------------------------------------------

(Note that 'wikitextSize' is JavaScript UCS-2 characters, which is why it differs from the UTF-8 byte count size given in the task title.)

On my laptop, it takes 5.68s to parse as English (ie, no LanguageConverter), and XXXs to parse if I set my local wiki's $wgLanguageCode to zh (ie, enable LanguageConverter). (FWIW, leaving the language as English but setting $wgUsePigLatinVariant has the same effect, ie enables LanguageConverter which makes parsing slow.)

$ cat T223969.wt | time php maintenance/parse.php > /dev/null # 'en'
5.68user 0.17system 0:06.07elapsed 96%CPU (0avgtext+0avgdata 76868maxresident)k
512inputs+0outputs (4major+32233minor)pagefaults 0swaps
$ cat T223969.wt | time php maintenance/parse.php > /dev/null # 'zh'
83.21user 267.41system 5:52.38elapsed 99%CPU (0avgtext+0avgdata 109480maxresident)k
4048inputs+0outputs (12major+203405783minor)pagefaults 0swaps

Change 520293 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Improve LanguageConverter performance on pages with many HTML tags

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

Change 520294 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] LanguageConverter performance: Reuse the same string object for regexp

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

cscott added a comment.Jul 2 2019, 6:39 PM

With gerrit 520293 the time taken drops from:

83.21user 267.41system 5:52.38elapsed

to

6.60user 0.08system 0:06.72elapsed

Adding gerrit 520294 on top further reduces runtime to

6.02user 0.06system 0:06.11elapsed

on this zh.wikisource page.

Change 520293 merged by jenkins-bot:
[mediawiki/core@master] Improve LanguageConverter performance on pages with many HTML tags

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

Change 520294 merged by jenkins-bot:
[mediawiki/core@master] LanguageConverter performance: Reuse the same string object for regexp

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

cscott closed this task as Resolved.Jul 31 2019, 3:34 PM
cscott claimed this task.
Shizhao moved this task from Backlog to Closed on the Chinese-Sites board.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM