Page MenuHomePhabricator

Fatal error: Call to a member function inNamespace() on null (from FilePageLookup.php)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.32

message
Call to a member function inNamespace() on null
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.32/extensions/WikibaseMediaInfo/src/Content/MediaInfoHandler.php(154): Wikibase\MediaInfo\Services\FilePageLookup->getFilePage(Wikibase\MediaInfo\DataModel\MediaInfoId)
#1 /srv/mediawiki/php-1.35.0-wmf.32/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php(160): Wikibase\MediaInfo\Content\MediaInfoHandler->canCreateWithCustomId(Wikibase\MediaInfo\DataModel\MediaInfoId)
#2 /srv/mediawiki/php-1.35.0-wmf.32/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityStore.php(180): Wikibase\Repo\Store\Sql\WikiPageEntityStore->canCreateWithCustomId(Wikibase\MediaInfo\DataModel\MediaInfoId)
#3 /srv/mediawiki/php-1.35.0-wmf.32/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php(199): Wikibase\Lib\Store\TypeDispatchingEntityStore->canCreateWithCustomId(Wikibase\MediaInfo\DataModel\MediaInfoId)
#4 /srv/mediawiki/php-1.35.0-wmf.32/extensions/Wikibase/repo/includes/Api/SetClaim.php(124): Wikibase\Repo\Api\EntitySavingHelper->loadEntity(Wikibase\MediaInfo\DataModel\MediaInfoId)
#5 /srv/mediawiki/php-1.35.0-wmf.32/includes/api/ApiMain.php(1580): Wikibase\Repo\Api\SetClaim->execute()
#6 /srv/mediawiki/php-1.35.0-wmf.32/includes/api/ApiMain.php(523): ApiMain->executeAction()
#7 /srv/mediawiki/php-1.35.0-wmf.32/includes/api/ApiMain.php(494): ApiMain->executeActionWithErrorHandling()
#8 /srv/mediawiki/php-1.35.0-wmf.32/api.php(84): ApiMain->execute()
#9 /srv/mediawiki/w/api.php(3): require(string)
#10 {main}

Impact

User action was lost or aborted.

Notes

  • Seemed to be one small burst in the past 24 hours
  • Happens in a few bursts per week

Looking for "FilePageLookup.php: Call to a member function inNamespace() on null" in Logstash suggests it started 14 May with the deployment of 1.35.0-wmf.32, it was not seen prior to that.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle renamed this task from Call to a member function inNamespace() on null to Fatal error: Call to a member function inNamespace() on null (from FilePageLookup.php).May 27 2020, 6:28 PM
Krinkle updated the task description. (Show Details)
Krinkle edited Stack Trace. (Show Details)

This was caused by r594608 where the Wikibase's TitleFactory was just replaced with core's TitleFactory, but they were not equal. Precisely Wikibase's returns Title or throws StorageException while core's return Title or null. FilePageLookup.php relied on the behavior of exception thrown in try-block (exception will force the inNamespace() call to be skipped) and return null later. But switching to core's TitleFactory made the call to return only Title and null and subsequent call to inNamespace() method to continue unconditionally both on Title and on null.

Change 599384 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/extensions/WikibaseMediaInfo@master] Ensure inNamespace() is called only on Title object

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

Change 599384 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Follow-up 1827c7a: Ensure inNamespace() is called only on Title object

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

Change 599460 had a related patch set uploaded (by Jforrester; owner: Ammarpad):
[mediawiki/extensions/WikibaseMediaInfo@wmf/1.35.0-wmf.34] Follow-up 1827c7a: Ensure inNamespace() is called only on Title object

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

Change 599460 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@wmf/1.35.0-wmf.34] Follow-up 1827c7a: Ensure inNamespace() is called only on Title object

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

Mentioned in SAL (#wikimedia-operations) [2020-05-28T22:41:09Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.34/extensions/WikibaseMediaInfo/src/Services/FilePageLookup.php: T253792 Follow-up 1827c7a: Ensure inNamespace() is called only on Title object (duration: 00m 58s)