Page MenuHomePhabricator

Wikimedia\RequestTimeout\RequestTimeoutException: The maximum execution time of {limit} seconds was exceeded
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error
  • mwversion: 1.45.0-wmf.24
  • timestamp: 2025-10-29T07:05:23.103Z
  • phpversion: 8.1.33
  • reqId: 8a0761c0-90cb-4e49-af4c-d09cf5ee49a2
  • Find reqId in Logstash
normalized_message
[{reqId}] {exception_url}   Wikimedia\RequestTimeout\RequestTimeoutException: The maximum execution time of {limit} seconds was exceeded
FrameLocationCall
from/srv/mediawiki/php-1.45.0-wmf.24/vendor/wikimedia/request-timeout/src/Detail/ExcimerTimerWrapper.php(92)
#0/srv/mediawiki/php-1.45.0-wmf.24/vendor/wikimedia/request-timeout/src/Detail/ExcimerRequestTimeout.php(34)Wikimedia\RequestTimeout\Detail\ExcimerTimerWrapper->exitCriticalSection(int)
#1/srv/mediawiki/php-1.45.0-wmf.24/vendor/wikimedia/request-timeout/src/CriticalSectionProvider.php(134)Wikimedia\RequestTimeout\Detail\ExcimerRequestTimeout->exitCriticalSection(int)
#2/srv/mediawiki/php-1.45.0-wmf.24/vendor/wikimedia/request-timeout/src/CriticalSectionScope.php(57)Wikimedia\RequestTimeout\CriticalSectionProvider->Wikimedia\RequestTimeout\{closure}(int)
#3/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/database/Database.php(3196)Wikimedia\RequestTimeout\CriticalSectionScope->exit()
#4/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/database/Database.php(717)Wikimedia\Rdbms\Database->completeCriticalSection(string, Wikimedia\RequestTimeout\CriticalSectionScope)
#5/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/database/Database.php(631)Wikimedia\Rdbms\Database->executeQuery(Wikimedia\Rdbms\Query, string, int)
#6/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/database/Database.php(1363)Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#7/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/database/DBConnRef.php(127)Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#8/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/database/DBConnRef.php(384)Wikimedia\Rdbms\DBConnRef->__call(string, array)
#9/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(762)Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#10/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthUser.php(519)Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet()
#11/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthUser.php(635)MediaWiki\Extension\CentralAuth\User\CentralAuthUser->loadGroups()
#12/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/objectcache/WANObjectCache.php(1828)MediaWiki\Extension\CentralAuth\User\CentralAuthUser->MediaWiki\Extension\CentralAuth\User\{closure}(bool, int, array, null, array)
#13/srv/mediawiki/php-1.45.0-wmf.24/includes/libs/objectcache/WANObjectCache.php(1632)Wikimedia\ObjectCache\WANObjectCache->fetchOrRegenerate(string, int, Closure, array, array)
#14/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthUser.php(651)Wikimedia\ObjectCache\WANObjectCache->getWithSetCallback(string, int, Closure, array)
#15/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthUser.php(470)MediaWiki\Extension\CentralAuth\User\CentralAuthUser->loadFromCache()
#16/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthUser.php(701)MediaWiki\Extension\CentralAuth\User\CentralAuthUser->loadState()
#17/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthUser.php(800)MediaWiki\Extension\CentralAuth\User\CentralAuthUser->getId()
#18/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthIdLookup.php(344)MediaWiki\Extension\CentralAuth\User\CentralAuthUser->exists()
#19/srv/mediawiki/php-1.45.0-wmf.24/extensions/CentralAuth/includes/User/CentralAuthIdLookup.php(290)MediaWiki\Extension\CentralAuth\User\CentralAuthIdLookup->isAttachedOn(MediaWiki\User\User, string, int)
#20/srv/mediawiki/php-1.45.0-wmf.24/extensions/GlobalUserPage/includes/GlobalUserPageManager.php(66)MediaWiki\Extension\CentralAuth\User\CentralAuthIdLookup->isAttached(MediaWiki\User\User)
#21/srv/mediawiki/php-1.45.0-wmf.24/extensions/GlobalUserPage/includes/Hooks.php(99)MediaWiki\GlobalUserPage\GlobalUserPageManager->shouldDisplayGlobalPage(MediaWiki\Title\Title)
#22/srv/mediawiki/php-1.45.0-wmf.24/includes/HookContainer/HookContainer.php(141)MediaWiki\GlobalUserPage\Hooks->onTitleIsAlwaysKnown(MediaWiki\Title\Title, null)
#23/srv/mediawiki/php-1.45.0-wmf.24/includes/HookContainer/HookRunner.php(4559)MediaWiki\HookContainer\HookContainer->run(string, array)
#24/srv/mediawiki/php-1.45.0-wmf.24/includes/title/Title.php(3131)MediaWiki\HookContainer\HookRunner->onTitleIsAlwaysKnown(MediaWiki\Title\Title, null)
#25/srv/mediawiki/php-1.45.0-wmf.24/includes/parser/Parser.php(2684)MediaWiki\Title\Title->isAlwaysKnown()
#26/srv/mediawiki/php-1.45.0-wmf.24/includes/parser/Parser.php(2382)MediaWiki\Parser\Parser->handleInternalLinks2(string)
#27/srv/mediawiki/php-1.45.0-wmf.24/includes/parser/Parser.php(1549)MediaWiki\Parser\Parser->handleInternalLinks(string)
#28/srv/mediawiki/php-1.45.0-wmf.24/includes/parser/Parser.php(608)MediaWiki\Parser\Parser->internalParse(string)
#29/srv/mediawiki/php-1.45.0-wmf.24/includes/content/WikitextContentHandler.php(375)MediaWiki\Parser\Parser->parse(string, MediaWiki\Title\Title, MediaWiki\Parser\ParserOptions, bool, bool, int)
#30/srv/mediawiki/php-1.45.0-wmf.24/includes/content/ContentHandler.php(1575)MediaWiki\Content\WikitextContentHandler->fillParserOutput(MediaWiki\Content\WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, MediaWiki\Parser\ParserOutput)
#31/srv/mediawiki/php-1.45.0-wmf.24/includes/content/Renderer/ContentRenderer.php(67)MediaWiki\Content\ContentHandler->getParserOutput(MediaWiki\Content\WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#32/srv/mediawiki/php-1.45.0-wmf.24/includes/Revision/RenderedRevision.php(247)MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(MediaWiki\Content\WikitextContent, MediaWiki\Page\PageIdentityValue, MediaWiki\Revision\RevisionStoreRecord, MediaWiki\Parser\ParserOptions, array)
#33/srv/mediawiki/php-1.45.0-wmf.24/includes/Revision/RenderedRevision.php(219)MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(MediaWiki\Content\WikitextContent, array)
#34/srv/mediawiki/php-1.45.0-wmf.24/includes/Revision/RevisionRenderer.php(223)MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#35/srv/mediawiki/php-1.45.0-wmf.24/includes/Revision/RevisionRenderer.php(156)MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, MediaWiki\Parser\ParserOptions, array)
#36/srv/mediawiki/php-1.45.0-wmf.24/includes/Revision/RenderedRevision.php(182)MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#37/srv/mediawiki/php-1.45.0-wmf.24/includes/page/ParserOutputAccess.php(586)MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#38/srv/mediawiki/php-1.45.0-wmf.24/includes/page/ParserOutputAccess.php(499)MediaWiki\Page\ParserOutputAccess->renderRevision(MediaWiki\Page\PageStoreRecord, MediaWiki\Parser\ParserOptions, MediaWiki\Revision\RevisionStoreRecord, array, null)
#39/srv/mediawiki/php-1.45.0-wmf.24/extensions/TextExtracts/includes/ApiQueryExtracts.php(245)MediaWiki\Page\ParserOutputAccess->getParserOutput(MediaWiki\Page\PageStoreRecord, MediaWiki\Parser\ParserOptions)
#40/srv/mediawiki/php-1.45.0-wmf.24/extensions/TextExtracts/includes/ApiQueryExtracts.php(173)MediaWiki\Extension\TextExtracts\ApiQueryExtracts->parse(MediaWiki\Page\WikiPage)
#41/srv/mediawiki/php-1.45.0-wmf.24/extensions/TextExtracts/includes/ApiQueryExtracts.php(110)MediaWiki\Extension\TextExtracts\ApiQueryExtracts->getExtract(MediaWiki\Title\Title)
#42/srv/mediawiki/php-1.45.0-wmf.24/includes/api/ApiQuery.php(732)MediaWiki\Extension\TextExtracts\ApiQueryExtracts->execute()
#43/srv/mediawiki/php-1.45.0-wmf.24/includes/api/ApiMain.php(2038)MediaWiki\Api\ApiQuery->execute()
#44/srv/mediawiki/php-1.45.0-wmf.24/includes/api/ApiMain.php(946)MediaWiki\Api\ApiMain->executeAction()
#45/srv/mediawiki/php-1.45.0-wmf.24/includes/api/ApiMain.php(917)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#46/srv/mediawiki/php-1.45.0-wmf.24/includes/api/ApiEntryPoint.php(138)MediaWiki\Api\ApiMain->execute()
#47/srv/mediawiki/php-1.45.0-wmf.24/includes/MediaWikiEntryPoint.php(184)MediaWiki\Api\ApiEntryPoint->execute()
#48/srv/mediawiki/php-1.45.0-wmf.24/api.php(30)MediaWiki\MediaWikiEntryPoint->run()
#49/srv/mediawiki/w/api.php(3)require(string)
#50{main}
Impact

Failed requests that involve this code path.

Notes

There are ~2,000 errors over the last 2 months involving CentralAuthUser and RequestTimeoutException, with various stacktrace. The list can be seen here: https://logstash.wikimedia.org/goto/4282375f95a6eec4ec9c4d94ee85fe1b

Details

Request URL
https://en.wikipedia.org/w/api.php?action=query&exchars=*&explaintext=*&format=*&prop=*&redirects=*&titles=*&utf8=*

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

The stack trace in the task description is a parse (from the extracts API). So there are three options:

  • CentralAuthUser::loadState() is slow (some kind of lock contention?)
  • Parsing is slow, because it makes many CentralAuthUser::loadState() calls (they are from the TitleIsAlwaysKnown hook in GlobalUserPage which is trying to determine whether the user page link should be red or blue).
  • Parsing is slow for some unrelated reason (maybe the page is just huge) and CentralAuthUser::loadState() just happens to be where it hits the time limit. Not very likely if it shows up regularly in the stack traces.

Probably it's the second. The log event linked from the description is for https://en.wikipedia.org/wiki/Wikipedia:Arbitration_Committee_Elections_December_2019/Coordination/SP/human?action=raw (parsing times out on the web UI as well) which has about 40K user page links, so not very surprising that it times out.

Unhelpfully, the parser checks Title::isAlwaysKnown() before Title::exists() even though the latter is batched and way way cheaper.

I don't think there is anything in CentralAuth that can be done here. Either the parser should support batch lookup / warming of isAlwaysKnown() (there is already a comment to that effect in the code) or there should be some way to increment the expensive counter from a TitleIsAlwaysKnown hook handler. Or at least the order of operations should be flipped and isAlwaysKnown() only called for non-existent titles, although that wouldn't help on a page with lots of links to non-existent user pages.

How high priority is this? Can it wait until the Parsoid roll out (June 2026)? We'd like to fix this only on the Parsoid side if possible, rather than having to do multiple fixes.

Is there already a batch API that can be used for the media namespace, or is part of this task building a batch API for ::isAlwaysKnown queries?

I think we'd need to build a batch version of the TitleIsAlwaysKnown hook (or something more generic, like a WarmTitleCache hook).

This is an issue with the media namespace as well (where the color of a link to a file description page can depend on whether the file exists on another wiki), but the error in this task is about user namespace links. And in theory it could be anything, depending on what extensions implement TitleIsAlwaysKnown and how.

Dreamy_Jazz subscribed.

This has nothing to do with CheckUser-SuggestedInvestigations from what I can see. Removing that tag.

Dreamy_Jazz added a parent task: Restricted Task.Dec 9 2025, 1:40 PM

The root cause seems to be the calls to CentralAuthIdLookup::isAttached which loads the entire CentralAuthUser object for each user that is checked. For example, a request that I ran using the excimer profile includes 11 seconds of just loading user groups. These are not even used as part of the ::isAttached check.

To fix this, a method needs to be added that allows batching the evaluation of ::shouldDisplayGlobalPage that uses the batch TitleIsAlwaysKnown hook proposed above. Then that code would use CentralIdLookup::lookupAttachedUserNames for the batch lookup

There is no way loading user groups can take 11 seconds, without some sort of deadlock. It's a straightforward SELECT using the primary key, returning a few dozen rows at most.

There is no way loading user groups can take 11 seconds, without some sort of deadlock. It's a straightforward SELECT using the primary key, returning a few dozen rows at most.

This is because the SELECT query is duplicated hundreds of times, because the loading is not batched and one user-by-user. Therefore, while the queries themselves may not take 11s seconds in total with all the overhead it likely does.