Page MenuHomePhabricator

Special:TopicSubscriptions raises an exception when there are no topics
Closed, ResolvedPublicPRODUCTION ERROR

Description

InvalidArgumentException: Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field it_itemname

Error
normalized_message
[{reqId}] {exception_url}   InvalidArgumentException: Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field it_itemname
exception.trace
from /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/platform/SQLPlatform.php(245)
#0 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/platform/SQLPlatform.php(678): Wikimedia\Rdbms\Platform\SQLPlatform->makeList(array, integer)
#1 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/database/Database.php(3334): Wikimedia\Rdbms\Platform\SQLPlatform->selectSQLText(array, array, array, string, array, array)
#2 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/database/DatabaseMySQL.php(730): Wikimedia\Rdbms\Database->selectSQLText(array, array, array, string, array, array)
#3 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/database/Database.php(1342): Wikimedia\Rdbms\DatabaseMySQL->selectSQLText(array, array, array, string, array, array)
#4 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(351): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.42.0-wmf.26/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(730): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.42.0-wmf.26/extensions/DiscussionTools/includes/ThreadItemStore.php(322): Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet()
#8 /srv/mediawiki/php-1.42.0-wmf.26/extensions/DiscussionTools/includes/ThreadItemStore.php(101): MediaWiki\Extension\DiscussionTools\ThreadItemStore->fetchItemsResultSet(Wikimedia\Rdbms\SelectQueryBuilder)
#9 /srv/mediawiki/php-1.42.0-wmf.26/extensions/DiscussionTools/includes/TopicSubscriptionsPager.php(68): MediaWiki\Extension\DiscussionTools\ThreadItemStore->findNewestRevisionsByName(array, integer)
#10 /srv/mediawiki/php-1.42.0-wmf.26/includes/pager/IndexPager.php(297): MediaWiki\Extension\DiscussionTools\TopicSubscriptionsPager->preprocessResults(Wikimedia\Rdbms\MysqliResultWrapper)
#11 /srv/mediawiki/php-1.42.0-wmf.26/includes/pager/IndexPager.php(839): MediaWiki\Pager\IndexPager->doQuery()
#12 /srv/mediawiki/php-1.42.0-wmf.26/includes/pager/TablePager.php(310): MediaWiki\Pager\IndexPager->isNavigationBarShown()
#13 /srv/mediawiki/php-1.42.0-wmf.26/includes/pager/TablePager.php(119): MediaWiki\Pager\TablePager->getNavigationBar()
#14 /srv/mediawiki/php-1.42.0-wmf.26/extensions/DiscussionTools/includes/SpecialTopicSubscriptions.php(51): MediaWiki\Pager\TablePager->getFullOutput()
#15 /srv/mediawiki/php-1.42.0-wmf.26/includes/specialpage/SpecialPage.php(718): MediaWiki\Extension\DiscussionTools\SpecialTopicSubscriptions->execute(NULL)
#16 /srv/mediawiki/php-1.42.0-wmf.26/includes/specialpage/SpecialPageFactory.php(1669): MediaWiki\SpecialPage\SpecialPage->run(NULL)
#17 /srv/mediawiki/php-1.42.0-wmf.26/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#18 /srv/mediawiki/php-1.42.0-wmf.26/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#19 /srv/mediawiki/php-1.42.0-wmf.26/includes/MediaWikiEntryPoint.php(199): MediaWiki\Actions\ActionEntryPoint->execute()
#20 /srv/mediawiki/php-1.42.0-wmf.26/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#21 /srv/mediawiki/w/index.php(3): require(string)
#22 {main}
Impact
Notes

Event Timeline

It happens only when list is empty - no subscriptions.

Possible related commits: 52ae0f315219de3fbd146ef356f63a4059f688ee

Is any sense to call preprocessResults on empty set?

Thanks for reporting and investigating.

Is any sense to call preprocessResults on empty set?

Good question, it probably does not make much sense. Looking through other special pages using it: https://codesearch.wmcloud.org/search/?q=function+preprocessResults it looks like most of them start with if ( !$res->numRows() ) { return; } or something like that.

However, I don't really want to review 50+ special pages to make sure it would be a safe change, and it could also affect other code by third-party users that we don't have indexed in Codesearch, so I will just add a similar check to the DiscussionTools code for now.

Change #1019877 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] TopicSubscriptionsPager: Fix exception when no subscriptions

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

Esanders renamed this task from InvalidArgumentException: Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field it_itemname to Special:TopicSubscriptions raises an exception when there are no topics.Apr 16 2024, 7:30 AM
Esanders updated the task description. (Show Details)
Esanders added a subscriber: Bluehill395.

Change #1019877 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] TopicSubscriptionsPager: Fix exception when no subscriptions

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

The problem still occurs in 1.42. I think need to backport the changes.

The problem still occurs in 1.42. I think need to backport the changes.

Update the extension.

Test wiki on Patch demo by Wargo using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/235eb08b37/w/

EAkinloose subscribed.

No errors in console and log looks clean

Screenshot 2024-05-14 at 23.07.49.png (798×1 px, 102 KB)

The problem still occurs in 1.42. I think need to backport the changes.

Update the extension.

Updating can be tricky sometimes, we don't test current releases with 1.42 (or any previous MediaWiki releases). I guess it won't hurt to backport it.

Change #1031922 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@REL1_42] TopicSubscriptionsPager: Fix exception when no subscriptions

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

Change #1031922 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@REL1_42] TopicSubscriptionsPager: Fix exception when no subscriptions

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