Page MenuHomePhabricator

PHP Notice: Trying to get property 'nextSibling' of non-object
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Trying to get property 'nextSibling' of non-object
exception.trace
from /srv/mediawiki/php-1.40.0-wmf.6/extensions/DiscussionTools/includes/ApiDiscussionToolsPageInfo.php(185)
#0 /srv/mediawiki/php-1.40.0-wmf.6/extensions/DiscussionTools/includes/ApiDiscussionToolsPageInfo.php(185): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.40.0-wmf.6/extensions/DiscussionTools/includes/ApiDiscussionToolsPageInfo.php(90): MediaWiki\Extension\DiscussionTools\ApiDiscussionToolsPageInfo::getThreadItemsHtml(MediaWiki\Extension\DiscussionTools\ContentThreadItemSet)
#2 /srv/mediawiki/php-1.40.0-wmf.6/includes/api/ApiMain.php(1900): MediaWiki\Extension\DiscussionTools\ApiDiscussionToolsPageInfo->execute()
#3 /srv/mediawiki/php-1.40.0-wmf.6/includes/api/ApiMain.php(875): ApiMain->executeAction()
#4 /srv/mediawiki/php-1.40.0-wmf.6/includes/api/ApiMain.php(846): ApiMain->executeActionWithErrorHandling()
#5 /srv/mediawiki/php-1.40.0-wmf.6/api.php(90): ApiMain->execute()
#6 /srv/mediawiki/php-1.40.0-wmf.6/api.php(45): wfApiMain()
#7 /srv/mediawiki/w/api.php(3): require(string)
#8 {main}
Notes
  • happens about 3× per day
  • only on wikipedia wikis and mw.org in the last 30 days
  • certain GET requests to the API seem to cause it

Details

Request URL
https://sr.wikipedia.org/w/api.php?action=discussiontoolspageinfo&errorformat=*&errorsuselocal=*&format=*&formatversion=*&page=*&prop=*
Related Changes in Gerrit:

Event Timeline

ppelberg moved this task from Untriaged to Upcoming on the Editing-team board.

Definitely one that'd be easier to debug if we had the exact page it's being called on.

That said, it's happening on a heading:

$startNode = CommentUtils::closestElementWithSibling( $startRange->endContainer, 'next' );
$startNode = $startNode->nextSibling;

So I'd speculate: a page on which the very last element is a heading.

Definitely one that'd be easier to debug if we had the exact page it's being called on.

Check out the link in logstash you can expand the document there and see the exact request (we try to avoid exact links on error tasks for privacy reasons).

@thcipriani Ah, good point, thank you.

So here's a page which exhibits the issue: https://sr.wikipedia.org/wiki/%D0%A0%D0%B0%D0%B7%D0%B3%D0%BE%D0%B2%D0%BE%D1%80%3A%D0%A1%D0%B2%D0%B5%D1%82%D0%BB%D0%B0%D0%BD%D0%B0_%D0%A0%D0%B0%D0%B6%D0%BD%D0%B0%D1%82%D0%BE%D0%B2%D0%B8%D1%9B

It does indeed end with a section that only contains a heading. I can write a patch to make this a bit more robust.

Change 863012 had a related patch set uploaded (by DLynch; author: DLynch):

[mediawiki/extensions/DiscussionTools@master] Avoid error building threaditemshtml if there's an empty final section

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

Change 863012 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Avoid error building threaditemshtml if there's an empty final section

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

matmarex added a project: Skipped QA.

Looks fixed: https://logstash.wikimedia.org/goto/2f999b0e49ff2ca825f1f2f9a1cd169c

image.png (512×2 px, 50 KB)

In the query I linked previously: https://logstash.wikimedia.org/goto/a565d7eca62bcf6dcb646f4ada921da7, there are other recent errors, but these are actually a different issue with the same error message, which I filed as T325575.