Page MenuHomePhabricator

Argument 1 passed to WikibaseQuality\ConstraintReport\Job\CheckConstraintsJob::setResultsSource() must be an instance of WikibaseQuality\ConstraintReport\Api\CachingResultsSource, instance of WikibaseQuality\ConstraintReport\Api\CheckingResultsSource given, called in /srv/mediawiki/php-1.35.0-wmf.27/extensions/WikibaseQualityConstraints/src/Job/CheckConstraintsJob.php on line 49
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.27

message
Argument 1 passed to WikibaseQuality\ConstraintReport\Job\CheckConstraintsJob::setResultsSource() must be an instance of WikibaseQuality\ConstraintReport\Api\CachingResultsSource, instance of WikibaseQuality\ConstraintReport\Api\CheckingResultsSource given, called in /srv/mediawiki/php-1.35.0-wmf.27/extensions/WikibaseQualityConstraints/src/Job/CheckConstraintsJob.php on line 49

Impact

Moderate logspam, constraint check job effectively disabled on Test Wikidata.

Notes

Excerpt from CheckConstraintsJob::__construct():

$resultSource = ConstraintsServices::getResultsSource( MediaWikiServices::getInstance() );
'@phan-var CachingResultsSource $resultSource';
// This job should only ever be used when caching result sources are used.                                                                                           
$this->setResultsSource( $resultSource );

However, the ServiceWiring.php contains some conditions under which constraint check results can’t be cached even if caching is enabled – see T244726: WikibaseQualityConstraints can’t cache constraint results in federated setups. In particular:

if ( $entitySource->getDatabaseName() !== false ) {
	LoggerFactory::getInstance( 'WikibaseQualityConstraints' )->warning(
		'Cannot cache constraint check results for non-local source: ' .
		$entitySource->getSourceName()
	);
	$cacheCheckConstraintsResults = false;
	break;
}

And on Test Wikidata, for some reason:

lucaswerkmeister-wmde@mwmaint1002:~$ mwscript shell.php testwikidatawiki
Psy Shell v0.10.2 (PHP 7.2.26-1+0~20191218.33+debian9~1.gbpb5a340+wmf1 — cli) by Justin Hileman
>>> \Wikibase\Repo\WikibaseRepo::getDefaultInstance()->getEntitySourceDefinitions()->getSources()[0]->getDatabaseName()
=> "testwikidatawiki"

The entity source dbname is not false, but the actual dbname, misleading WikibaseQualityConstraints into believing that this is a federated wiki where constraint check results cannot be cached.

Details

Request ID
bbec4aae-bb05-40a9-bf50-efd748a254ef
Request URL
https://jobrunner.discovery.wmnet/rpc/RunSingleJob.php
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.27/extensions/WikibaseQualityConstraints/src/Job/CheckConstraintsJob.php(49): WikibaseQuality\ConstraintReport\Job\CheckConstraintsJob->setResultsSource(WikibaseQuality\ConstraintReport\Api\CheckingResultsSource)
#1 /srv/mediawiki/php-1.35.0-wmf.27/includes/jobqueue/Job.php(92): WikibaseQuality\ConstraintReport\Job\CheckConstraintsJob->__construct(Title, array)
#2 /srv/mediawiki/php-1.35.0-wmf.27/extensions/EventBus/includes/JobExecutor.php(179): Job::factory(string, array)
#3 /srv/mediawiki/php-1.35.0-wmf.27/extensions/EventBus/includes/JobExecutor.php(38): JobExecutor->getJobFromParams(array)
#4 /srv/mediawiki/rpc/RunSingleJob.php(76): JobExecutor->execute(array)
#5 {main}

Event Timeline

First occurrence in Logstash is on 2020-04-08T10:37:49; I don’t see any relevant-looking SAL entries around that time, but 1.35.0-wmf.27 was deployed to group0 the previous evening (2020-04-07, around 20:00, see T247774).

Note that the WikibaseQualityConstraints change to not cache results from federated sources was way back in wmf.20. Maybe wmf.27 contained a Wikibase change that caused testwikidatawiki to report its source database name as "testwikidatawiki" rather than false, though.

Basically sending the db name instead of "false" for getting db name of local entity source also broke term store in test wikidatawiki.

Change 589019 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[operations/mediawiki-config@master] Wikibase: Use false instead of database names for "local" entity sources on test wikis

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

Change 589019 merged by jenkins-bot:
[operations/mediawiki-config@master] Wikibase: Use false instead of database names for "local" entity sources on test wikis

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

Mentioned in SAL (#wikimedia-operations) [2020-04-15T14:09:28Z] <jforrester@deploy1001> Synchronized wmf-config/InitialiseSettings.php: T250181 T250183 Wikibase: Use false instead of database names for 'local' entity sources on test wikis (duration: 01m 06s)

Fix/band aid (I am still not sure what would be the right tm behaviour) https://gerrit.wikimedia.org/r/589019 might have helped with the problem. I am not sure how to remotely trigger that job to verify this. Mind advising @Lucas_Werkmeister_WMDE ?

It should happen after any edit to the constraint statements of a property, such as this one. And I don’t see any errors in logstash so far.

I would consider it a fix, by the way – I’ll check logstash again tomorrow, if there are no new occurrences of the error we can close this.