Page MenuHomePhabricator

Error: Call to a member function getId() on bool
Closed, DeclinedPublicPRODUCTION ERROR


[{reqId}] {exception_url}   Error: Call to a member function getId() on bool
from /srv/mediawiki/php-1.41.0-wmf.5/extensions/OAuth/src/SessionProvider.php(126)
#0 /srv/mediawiki/php-1.41.0-wmf.5/includes/session/SessionManager.php(537): MediaWiki\Extension\OAuth\SessionProvider->provideSessionInfo(WebRequest)
#1 /srv/mediawiki/php-1.41.0-wmf.5/includes/session/SessionManager.php(244): MediaWiki\Session\SessionManager->getSessionInfoForRequest(WebRequest)
#2 /srv/mediawiki/php-1.41.0-wmf.5/includes/WebRequest.php(840): MediaWiki\Session\SessionManager->getSessionForRequest(WebRequest)
#3 /srv/mediawiki/php-1.41.0-wmf.5/includes/session/SessionManager.php(165): WebRequest->getSession()
#4 /srv/mediawiki/php-1.41.0-wmf.5/includes/Setup.php(478): MediaWiki\Session\SessionManager::getGlobalSession()
#5 /srv/mediawiki/php-1.41.0-wmf.5/includes/WebStart.php(92): require_once(string)
#6 /srv/mediawiki/php-1.41.0-wmf.5/rest.php(29): require(string)
#7 /srv/mediawiki/w/rest.php(3): require(string)
#8 {main}


Request URL*&q=*

Event Timeline

Umherirrender added a subscriber: Umherirrender.

Code is $resourceServer->getUser()->getId() === 0 where $resourceServer is of type ResourceServer and ResourceServer::getUser is documented to return User only (no null or false).

There is possible a false from Utils::getLocalUserFromCentralId when local user is not found or attached, it seems $wgMWOAuthSharedUserIDs = true is set for wmf wikis (CommonsSettings.php sets $wgMWOAuthCentralWiki = 'metawiki' and that makes the other config true).

So there could be some race condition with autocreation of accounts on the local wiki (via CentralAuth?) and use of the oauth functions

pmiazga triaged this task as Medium priority.Aug 21 2023, 1:23 PM

There are no occurrences of this error in Logstash in the last 90 days, which is as far back as the logs go: Since we don't have a good idea of the cause or how to reproduce this ("could be some race condition"), I think this is not worth investigating until it reoccurs.