Page MenuHomePhabricator

DBReadOnlyError causes broken double page rendering
Closed, ResolvedPublic

Description

When testing something in codfw (via X-Wikimedia-Debug) I got the following when visiting a random page.


https://test2.wikipedia.org/wiki/1968年臺灣 (mw2099.codfw.wmnet)

Original exception: [1ececc4b] /wiki/1968%E5%B9%B4%E8%87%BA%E7%81%A3 DBReadOnlyError from line 789 of /srv/mediawiki/php-1.27.0-wmf.16/includes/db/Database.php: Database is read-only: Mediawiki is in read-only mode during maintenance, please try again in 15 minutes
Backtrace:
#0 /srv/mediawiki/php-1.27.0-wmf.16/includes/db/Database.php(1463): DatabaseBase->query(string, string)
#1 /srv/mediawiki/php-1.27.0-wmf.16/extensions/ShortUrl/ShortUrl.utils.php(54): DatabaseBase->insert(string, array, string, string)
#2 /srv/mediawiki/php-1.27.0-wmf.16/extensions/ShortUrl/ShortUrl.hooks.php(44): ShortUrlUtils::encodeTitle(Title)
#3 /srv/mediawiki/php-1.27.0-wmf.16/includes/Hooks.php(195): ShortUrlHooks::addToolboxLink(VectorTemplate, boolean)
#4 /srv/mediawiki/php-1.27.0-wmf.16/skins/Vector/VectorTemplate.php(319): Hooks::run(string, array)
#5 /srv/mediawiki/php-1.27.0-wmf.16/skins/Vector/VectorTemplate.php(273): VectorTemplate->renderPortal(string, array, string, string)
#6 /srv/mediawiki/php-1.27.0-wmf.16/skins/Vector/VectorTemplate.php(195): VectorTemplate->renderPortals(array)
#7 /srv/mediawiki/php-1.27.0-wmf.16/includes/skins/SkinTemplate.php(240): VectorTemplate->execute()
#8 /srv/mediawiki/php-1.27.0-wmf.16/includes/OutputPage.php(2363): SkinTemplate->outputPage()
#9 /srv/mediawiki/php-1.27.0-wmf.16/includes/MediaWiki.php(746): OutputPage->output()
#10 /srv/mediawiki/php-1.27.0-wmf.16/includes/MediaWiki.php(519): MediaWiki->main()
#11 /srv/mediawiki/php-1.27.0-wmf.16/index.php(43): MediaWiki->run()
#12 /srv/mediawiki/w/index.php(3): include(string)
#13 {main}

Exception caught inside exception handler: [0b006398] /wiki/1968%E5%B9%B4%E8%87%BA%E7%81%A3 DBReadOnlyError from line 789 of /srv/mediawiki/php-1.27.0-wmf.16/includes/db/Database.php: Database is read-only: Mediawiki is in read-only mode during maintenance, please try again in 15 minutes
Backtrace:
#0 /srv/mediawiki/php-1.27.0-wmf.16/includes/db/Database.php(1463): DatabaseBase->query(string, string)
#1 /srv/mediawiki/php-1.27.0-wmf.16/extensions/ShortUrl/ShortUrl.utils.php(54): DatabaseBase->insert(string, array, string, string)
#2 /srv/mediawiki/php-1.27.0-wmf.16/extensions/ShortUrl/ShortUrl.hooks.php(44): ShortUrlUtils::encodeTitle(Title)
#3 /srv/mediawiki/php-1.27.0-wmf.16/includes/Hooks.php(195): ShortUrlHooks::addToolboxLink(VectorTemplate, boolean)
#4 /srv/mediawiki/php-1.27.0-wmf.16/skins/Vector/VectorTemplate.php(319): Hooks::run(string, array)
#5 /srv/mediawiki/php-1.27.0-wmf.16/skins/Vector/VectorTemplate.php(273): VectorTemplate->renderPortal(string, array, string, string)
#6 /srv/mediawiki/php-1.27.0-wmf.16/skins/Vector/VectorTemplate.php(195): VectorTemplate->renderPortals(array)
#7 /srv/mediawiki/php-1.27.0-wmf.16/includes/skins/SkinTemplate.php(240): VectorTemplate->execute()
#8 /srv/mediawiki/php-1.27.0-wmf.16/includes/OutputPage.php(2363): SkinTemplate->outputPage()
#9 /srv/mediawiki/php-1.27.0-wmf.16/includes/exception/MWException.php(204): OutputPage->output()
#10 /srv/mediawiki/php-1.27.0-wmf.16/includes/exception/MWException.php(244): MWException->reportHTML()
#11 /srv/mediawiki/php-1.27.0-wmf.16/includes/exception/MWExceptionHandler.php(69): MWException->report()
#12 /srv/mediawiki/php-1.27.0-wmf.16/includes/exception/MWExceptionHandler.php(180): MWExceptionHandler::report(DBReadOnlyError)
#13 /srv/mediawiki/php-1.27.0-wmf.16/includes/MediaWiki.php(528): MWExceptionHandler::handleException(DBReadOnlyError)
#14 /srv/mediawiki/php-1.27.0-wmf.16/index.php(43): MediaWiki->run()
#15 /srv/mediawiki/w/index.php(3): include(string)
#16 {main}

Aside from the fact that something is trying to do a write on a page view, over GET, in read-only mode, and not catching it - (see T129658 for that) - the error that does happen is also breaking the page layout. Seems like it happens very late in the request cycle but still before the response is closed, so the user gets two (or three) full html responses mixed up on top of each other.

Event Timeline

Krinkle created this task.Mar 11 2016, 4:55 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 11 2016, 4:55 PM
Krinkle updated the task description. (Show Details)Mar 11 2016, 4:57 PM

To confirm, the same is not limited to page views. The same happens when DBReadOnlyError is thrown from e.g. action=markpatrolled.

Gilles closed this task as Resolved.Mar 17 2016, 8:16 PM
Gilles claimed this task.
Gilles added a subscriber: Gilles.
This comment was removed by Gilles.
Gilles reopened this task as Open.Mar 17 2016, 8:18 PM
Gilles removed Gilles as the assignee of this task.Mar 18 2016, 4:20 PM

Change 278339 had a related patch set uploaded (by Aaron Schulz):
Avoid double-rendering on late exceptions

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

Krinkle closed this task as Resolved.Mar 29 2016, 10:23 PM
Krinkle claimed this task.

With the above OutputPage patch applied (and the ShortUrl patch reverted locally as example test case), the output renders as follows:

Previously it would've been like this:

Change 278339 merged by jenkins-bot:
Avoid double-rendering on late exceptions

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