Page MenuHomePhabricator

OutOfBoundsException in WikibaseQualityConstraints setup on Beta Wikidata
Closed, ResolvedPublic

Description

https://wikidata.beta.wmflabs.org/wiki/Special:ConstraintReport

[XUsPsqwQBHcAAEa9wy0AAAAF] /wiki/Special:ConstraintReport OutOfBoundsException from line 361 of /srv/mediawiki/php-master/extensions/Wikibase/repo/includes/Rdf/RdfVocabulary.php:

Backtrace:

#0 /srv/mediawiki/php-master/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Helper/SparqlHelper.php(165): Wikibase\Rdf\RdfVocabulary->getNamespaceURI(string)
#1 /srv/mediawiki/php-master/extensions/WikibaseQualityConstraints/src/ServiceWiring.php(148): WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\SparqlHelper->__construct(GlobalVarConfig, Wikibase\Rdf\RdfVocabulary, Wikibase\DataModel\Entity\DispatchingEntityIdParser, Wikibase\Lib\PropertyInfoDataTypeLookup, WANObjectCache, WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageSerializer, WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageDeserializer, BufferingStatsdDataFactory, WikibaseQuality\ConstraintReport\Api\ExpiryLock, WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\LoggingHelper, string, MediaWiki\Http\HttpRequestFactory)
#2 /srv/mediawiki/php-master/includes/libs/services/ServiceContainer.php(443): Closure$WikibaseQuality\ConstraintReport\#12(MediaWiki\MediaWikiServices)
#3 /srv/mediawiki/php-master/includes/libs/services/ServiceContainer.php(421): Wikimedia\Services\ServiceContainer->createService(string)
…

The problematic call in SparqlHelper is this:

$this->entityPrefix = $rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_ENTITY );

Which calls this RdfVocabulary function:

public function getNamespaceURI( $ns ) {
	if ( !isset( $this->namespaces[$ns] ) ) {
		throw new OutOfBoundsException();
	}

	return $this->namespaces[$ns];
}

Apparently NS_ENTITY is no longer defined – @Smalyshev or @WMDE-leszek, IIRC you had some recent changes in this area, could this be related? (I don’t have more time to investigate this right now, sorry.)

Note that this also breaks the API sandbox because the error is also thrown when trying to download parameter info (including for WikibaseQualityConstraints’ modules).

Event Timeline

Okay, I did have time for a quick git bisect, and according to that the culprit is Ie8ef676d9e, linked to T211799, T214557, T222306.

Hmm, possibly this patch changes config requirements in some incompatible way? I'll try to check what's going on.

So it's a bit tricky since in the new scheme the entity URI actually depends on the repository. So we probably have to check all possible entity prefixes really.
Another this is - do we even need $this->prefixes? WDQS understands all those by default already.

Change 528968 had a related patch set uploaded (by Smalyshev; owner: Smalyshev):
[mediawiki/extensions/WikibaseQualityConstraints@master] Fix RDF handling in SparqlHelper.php

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

Note also that CheckConstraintsRdf.php contains mention of RdfVocabulary::NS_STATEMENT which can also possibly break after this patch.

Another this is - do we even need $this->prefixes? WDQS understands all those by default already.

We don’t send them in production (T204317), but in theory the extension is supposed to work with any SPARQL endpoint (it doesn’t use any non-standard features by default).

Setting it to High priority since it will start generating problems in production as soon as the train gets there, I imagine.

Well, there’s no train this week (Wikimania), but we could add it to next week’s train blockers already.

Change 529812 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[mediawiki/extensions/WikibaseQualityConstraints@master] Adjusted calls RdfVocubulary methods

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

zeljkofilipin raised the priority of this task from High to Unbreak Now!.Aug 14 2019, 3:19 PM
zeljkofilipin subscribed.

Train blockers are UBN.

@WMDE-leszek you patch is still WIP, are you still working on it?

@WMDE-leszek you patch is still WIP, are you still working on it?

un-WIP-ed it, sorry for not doing it earlier. The patch is not the most beautiful one, but in terms of the approach to fix the bug, it is complete.

Change 528968 abandoned by Smalyshev:
Fix RDF handling in SparqlHelper.php

Reason:
fixed in another patch

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

Change 529812 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Adjusted calls to RdfVocabulary methods

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

@WMDE-leszek is this resolved? As far as I can see, all related patches are either merged or abandoned. If this is still blocking the train, I'll cut the branch tomorrow, but I will not deploy it to group 0. If this is either resolved or no longer blocking the train, please update the task. Thanks!

alaa_wmde claimed this task.
alaa_wmde subscribed.

This seems to have been resolved. I can access api sandbox on beta, as well as https://wikidata.beta.wmflabs.org/wiki/Special:ConstraintReport successfully.

@zeljkofilipin