Page MenuHomePhabricator

Exception from TermStoreWriterFactory : Local entity source does not have items.
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.34

message
Local entity source does not have items.

Impact

Production fatal errors.

Train blocker

Notes

Details

Request ID
e6a68534-8d0e-4d15-8e7c-24e4ad3213ab
Request URL
https://commons.wikimedia.org/w/api.php
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.34/extensions/Wikibase/repo/includes/WikibaseRepo.php(1831): Wikibase\Lib\Store\Sql\Terms\TermStoreWriterFactory->newItemTermStoreWriter()
#1 /srv/mediawiki/php-1.35.0-wmf.34/extensions/Wikibase/repo/includes/WikibaseRepo.php(1789): Wikibase\Repo\WikibaseRepo->getItemTermStoreWriters()
#2 /srv/mediawiki/php-1.35.0-wmf.34/extensions/Wikibase/repo/WikibaseRepo.entitytypes.php(85): Wikibase\Repo\WikibaseRepo->newItemHandler()
#3 [internal function]: Wikibase\Repo\WikibaseRepo::{closure}()
#4 /srv/mediawiki/php-1.35.0-wmf.34/extensions/Wikibase/repo/includes/Content/EntityContentFactory.php(297): call_user_func(Closure)
#5 /srv/mediawiki/php-1.35.0-wmf.34/extensions/Wikibase/repo/RepoHooks.php(135): Wikibase\Repo\Content\EntityContentFactory->getContentHandlerForType(string)
#6 /srv/mediawiki/php-1.35.0-wmf.34/vendor/wikimedia/object-factory/src/ObjectFactory.php(172): Wikibase\RepoHooks::Wikibase\{closure}(string)
#7 /srv/mediawiki/php-1.35.0-wmf.34/vendor/wikimedia/object-factory/src/ObjectFactory.php(102): Wikimedia\ObjectFactory::getObjectFromSpec(array, array)
#8 /srv/mediawiki/php-1.35.0-wmf.34/includes/content/ContentHandlerFactory.php(222): Wikimedia\ObjectFactory->createObject(Closure, array)
#9 /srv/mediawiki/php-1.35.0-wmf.34/includes/content/ContentHandlerFactory.php(170): MediaWiki\Content\ContentHandlerFactory->createContentHandlerFromHandlerSpec(string, Closure)
#10 /srv/mediawiki/php-1.35.0-wmf.34/includes/content/ContentHandlerFactory.php(82): MediaWiki\Content\ContentHandlerFactory->createForModelID(string)
#11 /srv/mediawiki/php-1.35.0-wmf.34/includes/content/ContentHandlerFactory.php(140): MediaWiki\Content\ContentHandlerFactory->getContentHandler(string)
#12 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiEditPage.php(616): MediaWiki\Content\ContentHandlerFactory->getAllContentFormats()
#13 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiBase.php(1700): ApiEditPage->getAllowedParams(integer)
#14 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiBase.php(673): ApiBase->getFinalParams()
#15 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiMain.php(1178): ApiBase->extractRequestParams()
#16 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiMain.php(1562): ApiMain->setupModule()
#17 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiMain.php(523): ApiMain->executeAction()
#18 /srv/mediawiki/php-1.35.0-wmf.34/includes/api/ApiMain.php(494): ApiMain->executeActionWithErrorHandling()
#19 /srv/mediawiki/php-1.35.0-wmf.34/api.php(84): ApiMain->execute()
#20 /srv/mediawiki/w/api.php(3): require(string)
#21 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
mmodell triaged this task as Unbreak Now! priority.May 27 2020, 7:59 PM

So, Commons needs to be able to create an ItemHandler object in order to be able to do things with Items.
An ItemHandler currently needs a ItemTermStoreWriter, as ContentHandler is also what does writes and secondary data updates in getSecondaryDataUpdates
The patch above introduced a check making sure that these writers would only be created when the local entity source / local wiki has access to Items for writing, hence the exception.

We could do one of the following:

  • Keep the check in the same place and instead inject the TermStoreWriterFactory into ItemHandler (or pass in a callback rather than an instantiated service)
  • Move the check out of TermStoreWriterFactory and into ItemTermStoreWriter? (feel ugly and this is what we just moved away from, why should the service be concerned with this?)

Will continue on this in the morning

The ideal solution would be that the ItemHandler, or the thing only needing access to read data, shouldn't need services that are only used for writing.
But the Handlers are used for both right now and I believe that would need fixes in core.

Thanks for working on this, @Addshore. Let me know if I can help!

Change 599352 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] Use ThrowingEntityTermStoreWriter when writers shouldn't be called

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

Change 599364 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.34] Use ThrowingEntityTermStoreWriter when writers shouldn't be called

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

Change 599364 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.34] Use ThrowingEntityTermStoreWriter when writers shouldn't be called

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

Mentioned in SAL (#wikimedia-operations) [2020-05-28T16:32:58Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.34/extensions/Wikibase: T253804 Use ThrowingEntityTermStoreWriter when writers shouldn't be called (duration: 01m 15s)

Change 599352 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Use ThrowingEntityTermStoreWriter when writers shouldn't be called

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