Page MenuHomePhabricator

internal_api_error_BadMethodCallException from GettingStarted morelike task type
Closed, ResolvedPublic

Description

Author: swalling

Description:
The post-edit notification fails to trigger on Beta Labs with the following error response.

"info":"Exception Caught: Call to a member function addInterwikiResults() on a non-object (NULL)","*":"\n\n#0 /srv/common-local/php-master/includes/api/ApiQuerySearch.php(100): CirrusSearch->searchText()\n#1 /srv/common-local/php-master/includes/api/ApiQuerySearch.php(47): ApiQuerySearch->run()\n#2 /srv/common-local/php-master/includes/api/ApiQuery.php(281): ApiQuerySearch->execute()\n#3 /srv/common-local/php-master/includes/api/ApiMain.php(907): ApiQuery->execute()\n#4 /srv/common-local/php-master/includes/api/ApiMain.php(332): ApiMain->executeAction()\n#5 /srv/common-local/php-master/extensions/GettingStarted/MoreLikePageSuggester.php(53): ApiMain->execute()\n#6 /srv/common-local/php-master/extensions/GettingStarted/api/ApiGettingStartedGetPages.php(66): GettingStarted\\MoreLikePageSuggester->getArticles()\n#7 /srv/common-local/php-master/extensions/GettingStarted/api/ApiGettingStartedGetPages.php(32): GettingStarted\\ApiGettingStartedGetPages->getArticles()\n#8 /srv/common-local/php-master/includes/api/ApiPageSet.php(176): GettingStarted\\ApiGettingStartedGetPages->executeGenerator()\n#9 /srv/common-local/php-master/includes/api/ApiPageSet.php(132): ApiPageSet->executeInternal()\n#10 /srv/common-local/php-master/includes/api/ApiQuery.php(265): ApiPageSet->execute()\n#11 /srv/common-local/php-master/includes/api/ApiMain.php(907): ApiQuery->execute()\n#12 /srv/common-local/php-master/includes/api/ApiMain.php(363): ApiMain->executeAction()\n#13 /srv/common-local/php-master/includes/api/ApiMain.php(334): ApiMain->executeActionWithErrorHandling()\n#14 /srv/common-local/php-master/api.php(85): ApiMain->execute()\n#15 /srv/common-local/w/api.php(3): include()\n#16 {main}\n\n"


Version: unspecified
Severity: normal

Details

Reference
bz68887

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:38 AM
bzimport added a project: CirrusSearch.
bzimport set Reference to bz68887.

swalling wrote:

After more testing: many older articles on beta labs work just fine. This specifically appeared on editing a newly-imported page, like http://en.wikipedia.beta.wmflabs.org/wiki/Cheese

It's reproducible on non-existent articles (http://en.wikipedia.beta.wmflabs.org/w/api.php?action=query&list=gettingstartedgetpages&gsgptaskname=morelike&gsgpcount=9&gsgpexcludedtitle=asdfasdfasdfasdfasdf&format=xmlfm) and just-created ones (as originally reported).

It seems to be an issue in CirrusSearch where it calls addInterwikiResults on a null object. I think this indicates the initial search had no results (but didn't throw an error or anything), and it then tries to do an interwiki search.

In production, it looks like this currently affects the Italian projects (GettingStarted is installed on Italian Wikipedia).

Change 156607 had a related patch set uploaded by Manybubbles:
Don't add interwiki results to null

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

Thanks for the easy reproduction steps. Sorry it took me so long to get to.

Change 156607 merged by jenkins-bot:
Don't add interwiki results to null

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

Nik, doesn't that mean it won't show any interwiki results if there are not results on the current wiki (since "0 results" == null)?

I'm not totally sure how interwiki results are supposed to work, but that seems like it might not be desired behavior. E.g. on English Wikipedia, should it show English Wiktionary results even if there are no English Wikipedia results? Is that how interwiki results normally work (other than the 0 results part)?

Nah, an empty search results object isn't falsy in this case. Its an object rather than an array. Though, you are right it'd be more clear to check for null directly. You want to send a patch :) ?

Also, some proof:
https://it.wiktionary.org/w/index.php?title=Speciale%3ARicerca&profile=default&search=ulteriori+informazioni&fulltext=Search

(In reply to Nik Everett from comment #7)

Nah, an empty search results object isn't falsy in this case. Its an object
rather than an array. Though, you are right it'd be more clear to check for
null directly. You want to send a patch :) ?

I wasn't thinking of weak type equality issues, but rather https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FCirrusSearch.git/bc8ac094eaa9ebbc22de44667c4ea97ca0fb70b4/includes%2FCirrusSearch.php#L61 :

  • @return Search\ResultSet|null|Status results, no results, or error respectively

which apparently indicates (second in list on both sides) that null means "no results":

Also, some proof:
https://it.wiktionary.org/w/index.
php?title=Speciale%3ARicerca&profile=default&search=ulteriori+informazioni&fu
lltext=Search

Thanks for reassuring me.

That feature is awesome, by the way.