Page MenuHomePhabricator

CentralNotice: Timeout when creating translation variables Translate Extension
Closed, ResolvedPublic

Description

Simply unable to create any new translation variables. Timeouts and no variable created.

Event Timeline

I've confirmed this bug on production. I created a new banner, T231703_test, then added four translatable messages to the banner content, and tried to save it.

After waiting for two minutes, I got an error page back.

While the actual banner content was correctly saved, the CN UI doesn't show any translatable message fields.

The errors in LogStash sure seem similar to those we've seen before!

PHP Fatal Error: entire web request took longer than 200 seconds and timed out
#0 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/TranslateMetadata.php(23): NO_FUNCTION_GIVEN()
#1 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/TranslateMetadata.php(43): TranslateMetadata::preloadGroups()
#2 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/TranslateHooks.php(671): TranslateMetadata::get(string, string)
#3 /srv/mediawiki/php-1.34.0-wmf.20/includes/Hooks.php(174): TranslateHooks::hideRestrictedFromStats(string, string)
#4 /srv/mediawiki/php-1.34.0-wmf.20/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#5 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageGroupStats.php(515): Hooks::run(string, array)
#6 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageGroupStats.php(456): MessageGroupStats::calculateAggregageGroup(array, AggregateMessageGroup, string, integer)
#7 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageGroupStats.php(211): MessageGroupStats::forItemInternal(array, AggregateMessageGroup, string, integer)
#8 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageGroupStats.php(197): MessageGroupStats::internalClearGroups(string, array)
#9 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageIndex.php(277): MessageGroupStats::clearGroup(array)
#10 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageIndex.php(196): MessageIndex->clearMessageGroupStats(array)
#11 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageIndexRebuildJob.php(36): MessageIndex->rebuild()
#12 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/Banner.php(1053): MessageIndexRebuildJob->run()
#13 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(966): Banner->save(User, string)
#14 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(911): SpecialCentralNoticeBanners->processSaveBannerAction(array)
#15 /srv/mediawiki/php-1.34.0-wmf.20/includes/htmlform/HTMLForm.php(689): SpecialCentralNoticeBanners->processEditBanner(array, CentralNoticeHtmlForm)
#16 /srv/mediawiki/php-1.34.0-wmf.20/includes/htmlform/HTMLForm.php(581): HTMLForm->trySubmit()
#17 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(435): HTMLForm->tryAuthorizedSubmit()
#18 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(97): SpecialCentralNoticeBanners->showBannerEditor()
#19 /srv/mediawiki/php-1.34.0-wmf.20/includes/specialpage/SpecialPage.php(573): SpecialCentralNoticeBanners->execute(string)
#20 /srv/mediawiki/php-1.34.0-wmf.20/includes/specialpage/SpecialPageFactory.php(582): SpecialPage->run(string)
#21 /srv/mediawiki/php-1.34.0-wmf.20/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#22 /srv/mediawiki/php-1.34.0-wmf.20/includes/MediaWiki.php(892): MediaWiki->performRequest()
#23 /srv/mediawiki/php-1.34.0-wmf.20/includes/MediaWiki.php(523): MediaWiki->main()
#24 /srv/mediawiki/php-1.34.0-wmf.20/index.php(42): MediaWiki->run()
#25 /srv/mediawiki/w/index.php(3): include(string)
#26 {main}

Here's the other error linked to the same request Id:

Query returned 121466 row(s):
query-m: SELECT * FROM `translate_messageindex`  [TRX#3b7637]
#0 /srv/mediawiki/php-1.34.0-wmf.20/includes/libs/rdbms/database/Database.php(1330): Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion()
#1 /srv/mediawiki/php-1.34.0-wmf.20/includes/libs/rdbms/database/Database.php(1210): Wikimedia\Rdbms\Database->executeQueryAttempt()
#2 /srv/mediawiki/php-1.34.0-wmf.20/includes/libs/rdbms/database/Database.php(1146): Wikimedia\Rdbms\Database->executeQuery()
#3 /srv/mediawiki/php-1.34.0-wmf.20/includes/libs/rdbms/database/Database.php(1794): Wikimedia\Rdbms\Database->query()
#4 /srv/mediawiki/php-1.34.0-wmf.20/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select()
#5 /srv/mediawiki/php-1.34.0-wmf.20/includes/libs/rdbms/database/DBConnRef.php(315): Wikimedia\Rdbms\DBConnRef->__call()
#6 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageIndex.php(477): Wikimedia\Rdbms\DBConnRef->select()
#7 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageIndex.php(167): DatabaseMessageIndex->retrieve()
#8 /srv/mediawiki/php-1.34.0-wmf.20/extensions/Translate/utils/MessageIndexRebuildJob.php(36): MessageIndex->rebuild()
#9 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/Banner.php(1053): MessageIndexRebuildJob->run()
#10 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(966): Banner->save()
#11 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(911): SpecialCentralNoticeBanners->processSaveBannerAction()
#12 /srv/mediawiki/php-1.34.0-wmf.20/includes/htmlform/HTMLForm.php(689): SpecialCentralNoticeBanners->processEditBanner()
#13 /srv/mediawiki/php-1.34.0-wmf.20/includes/htmlform/HTMLForm.php(581): HTMLForm->trySubmit()
#14 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(435): HTMLForm->tryAuthorizedSubmit()
#15 /srv/mediawiki/php-1.34.0-wmf.20/extensions/CentralNotice/includes/specials/SpecialCentralNoticeBanners.php(97): SpecialCentralNoticeBanners->showBannerEditor()
#16 /srv/mediawiki/php-1.34.0-wmf.20/includes/specialpage/SpecialPage.php(573): SpecialCentralNoticeBanners->execute()
#17 /srv/mediawiki/php-1.34.0-wmf.20/includes/specialpage/SpecialPageFactory.php(582): SpecialPage->run()
#18 /srv/mediawiki/php-1.34.0-wmf.20/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath()
#19 /srv/mediawiki/php-1.34.0-wmf.20/includes/MediaWiki.php(892): MediaWiki->performRequest()
#20 /srv/mediawiki/php-1.34.0-wmf.20/includes/MediaWiki.php(523): MediaWiki->main()
#21 /srv/mediawiki/php-1.34.0-wmf.20/index.php(42): MediaWiki->run()
#22 /srv/mediawiki/w/index.php(3): include()
#23 {main}

Hey @Nikerabbit let us know if you have any comments or insights.

You are still calling MessageIndexRebuildJob->run during user request, that is super slow. It would be better to defer it to the jobqueue.

I'm been working on deferring statistics update (triggered by changes in message groups), but it is going to slow no matter in what because it has to process hundreds of languages.

DStrine moved this task from Triage to Current Sprint on the Fundraising-Backlog board.

Change 459843 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/CentralNotice@master] Use MessageIndexRebuildJob insertIntoJobQueue method when saving Banner

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

Change 459843 merged by jenkins-bot:
[mediawiki/extensions/CentralNotice@master] Use MessageIndexRebuildJob insertIntoJobQueue method when saving Banner

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

Thanks, all!! :)

I think the timeout issue should be solved by the attached change, just merged now.

It seems the problem with the translatable message fields not showing up in the UI following the attempted save and timeout was just a complication of T72939, exacerbated by a stale object cache value. (Here's a proposed fix for that issue in general.)

The timeout issue seems to be fine now... Just confirming that we can close this? Thanks much!!!