Page MenuHomePhabricator

InvalidArgumentException: Data for lt_namespace and lt_title must be non-empty
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Around 1200 of these:

labels.normalized_message
[{reqId}] {exception_url}   InvalidArgumentException: Data for lt_namespace and lt_title must be non-empty
error.stack_trace
from /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/platform/SQLPlatform.php(298)
#0 /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/database/Database.php(3474): Wikimedia\Rdbms\Platform\SQLPlatform->makeWhereFrom2d(array, string, string)
#1 /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->makeWhereFrom2d(array, string, string)
#2 /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/database/DBConnRef.php(415): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#3 /srv/mediawiki/php-1.41.0-wmf.9/includes/cache/LinkBatch.php(373): Wikimedia\Rdbms\DBConnRef->makeWhereFrom2d(array, string, string)
#4 /srv/mediawiki/php-1.41.0-wmf.9/includes/api/ApiQueryLinks.php(139): LinkBatch->constructSet(string, Wikimedia\Rdbms\DBConnRef)
#5 /srv/mediawiki/php-1.41.0-wmf.9/includes/api/ApiQueryLinks.php(83): ApiQueryLinks->run()
#6 /srv/mediawiki/php-1.41.0-wmf.9/includes/api/ApiQuery.php(688): ApiQueryLinks->execute()
#7 /srv/mediawiki/php-1.41.0-wmf.9/includes/api/ApiMain.php(1914): ApiQuery->execute()
#8 /srv/mediawiki/php-1.41.0-wmf.9/includes/api/ApiMain.php(890): ApiMain->executeAction()
#9 /srv/mediawiki/php-1.41.0-wmf.9/includes/api/ApiMain.php(861): ApiMain->executeActionWithErrorHandling()
#10 /srv/mediawiki/php-1.41.0-wmf.9/api.php(93): ApiMain->execute()
#11 /srv/mediawiki/php-1.41.0-wmf.9/api.php(48): wfApiMain()
#12 /srv/mediawiki/w/api.php(3): require(string)
#13 {main}

And about 21 of the somewhat similar:

labels.normalized_message
[{reqId}] {exception_url}   InvalidArgumentException: Data for ftr_namespace and ftr_title must be non-empty
error.stack_trace
from /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/platform/SQLPlatform.php(298)
#0 /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/database/Database.php(3474): Wikimedia\Rdbms\Platform\SQLPlatform->makeWhereFrom2d(array, string, string)
#1 /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->makeWhereFrom2d(array, string, string)
#2 /srv/mediawiki/php-1.41.0-wmf.9/includes/libs/rdbms/database/DBConnRef.php(415): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#3 /srv/mediawiki/php-1.41.0-wmf.9/includes/cache/LinkBatch.php(373): Wikimedia\Rdbms\DBConnRef->makeWhereFrom2d(array, string, string)
#4 /srv/mediawiki/php-1.41.0-wmf.9/extensions/FlaggedRevs/backend/FRDependencyUpdate.php(173): LinkBatch->constructSet(string, Wikimedia\Rdbms\DBConnRef)
#5 /srv/mediawiki/php-1.41.0-wmf.9/extensions/FlaggedRevs/backend/FRDependencyUpdate.php(156): FRDependencyUpdate->makeWhereFrom2d(array, Wikimedia\Rdbms\DBConnRef)
#6 /srv/mediawiki/php-1.41.0-wmf.9/extensions/FlaggedRevs/backend/FRDependencyUpdate.php(83): FRDependencyUpdate->getDepDeletions(array, array)
#7 /srv/mediawiki/php-1.41.0-wmf.9/extensions/FlaggedRevs/backend/FRExtraCacheUpdateJob.php(68): FRDependencyUpdate->doUpdate(integer)
#8 /srv/mediawiki/php-1.41.0-wmf.9/extensions/FlaggedRevs/backend/FRExtraCacheUpdateJob.php(29): FRExtraCacheUpdateJob->doUpdateLinks()
#9 /srv/mediawiki/php-1.41.0-wmf.9/extensions/EventBus/includes/JobExecutor.php(79): FRExtraCacheUpdateJob->run()
#10 /srv/mediawiki/rpc/RunSingleJob.php(77): MediaWiki\Extension\EventBus\JobExecutor->execute(array)
#11 {main}
Impact

Unclear.

Notes

These started coming in steadily after moving T330215: 1.41.0-wmf.9 deployment blockers to group2 wikis.

Details

Request URL
https://fr.wikipedia.org/w/api.php?action=query&format=*&formatversion=*&palimit=*&pasubprojects=*&prop=*&redirects=*&titles=*&tllimit=*&tlnamespace=*&tltemplates=*&utf8=*

Event Timeline

brennen triaged this task as Unbreak Now! priority.May 18 2023, 6:47 PM
brennen created this task.

Change 921089 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] cache: Do not throw on empty set in LinkBatch::constructSet

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

Change 921089 merged by jenkins-bot:

[mediawiki/core@master] cache: Do not throw on empty set in LinkBatch::constructSet

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

Change 920744 had a related patch set uploaded (by Brennen Bearnes; author: Umherirrender):

[mediawiki/core@wmf/1.41.0-wmf.9] cache: Do not throw on empty set in LinkBatch::constructSet

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

Change 920744 merged by jenkins-bot:

[mediawiki/core@wmf/1.41.0-wmf.9] cache: Do not throw on empty set in LinkBatch::constructSet

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

Mentioned in SAL (#wikimedia-operations) [2023-05-18T21:03:41Z] <brennen@deploy1002> Started scap: Backport for [[gerrit:920744|cache: Do not throw on empty set in LinkBatch::constructSet (T336964)]]

Mentioned in SAL (#wikimedia-operations) [2023-05-18T21:05:13Z] <brennen@deploy1002> brennen: Backport for [[gerrit:920744|cache: Do not throw on empty set in LinkBatch::constructSet (T336964)]] synced to the testservers: mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug1002.eqiad.wmnet, mwdebug2002.codfw.wmnet

Mentioned in SAL (#wikimedia-operations) [2023-05-18T21:13:19Z] <brennen@deploy1002> Finished scap: Backport for [[gerrit:920744|cache: Do not throw on empty set in LinkBatch::constructSet (T336964)]] (duration: 09m 38s)

Still seeing:

[{reqId}] {exception_url}   InvalidArgumentException: Data for ftr_namespace and ftr_title must be non-empty

I'll file that separately.

Change 921089 merged by jenkins-bot:

[mediawiki/core@master] cache: Do not throw on empty set in LinkBatch::constructSet

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

This effectively reverts change 913682 since 99% of callers to makeWhereFrom2d come in via LinkBatch::constructSet, and brings back the underlying unsafe query problem.

I suspect this caller that this task was filed for is either new or I missed it when reviewing this Codesearch query. For example, there are many calls that effectively do $query->where( $linkBatch->constructSet() ), which can act in surprising ways when the value is boolean false. It is the callers responsibility to make sure to not go down the surrounding code path in the first place when the LinkBatch is empty and thus decide on some other way to handle that entirely.

I won't re-open this task though, but I'll make a follow-up tagged with this one for visibility that tries to fix the root problem of the two known violations we found (this and T336980) and then re-apply the exception for this error condition.

Some callers are already right and the exception would be wrong in that case:

ApiQueryLinks.php
			$cond = $lb->constructSet( $this->prefix, $this->getDB() );
			if ( $cond ) {
				$this->addWhere( $cond );

So this needs some more work to get the exception thrown by the database layer for invalid input in the LinkBatch class. Checking for empty in LinkBatch was the fast option, many functions in LinkBatch have a isEmpty check.

Change 921450 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] LinkBatch: Re-apply makeWhereFrom2d/constructSet exception

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

Change 921450 merged by jenkins-bot:

[mediawiki/core@master] LinkBatch: Re-apply makeWhereFrom2d/constructSet exception

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