Page MenuHomePhabricator

Error: Call to a member function inNamespace() on null
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Error: Call to a member function inNamespace() on null
exception.trace
from /srv/mediawiki/php-1.43.0-wmf.13/includes/specialpage/ChangesListSpecialPage.php(699)
#0 /srv/mediawiki/php-1.43.0-wmf.13/includes/specials/SpecialRecentChanges.php(223): MediaWiki\SpecialPage\ChangesListSpecialPage->execute(NULL)
#1 /srv/mediawiki/php-1.43.0-wmf.13/includes/specialpage/SpecialPage.php(719): MediaWiki\Specials\SpecialRecentChanges->execute(NULL)
#2 /srv/mediawiki/php-1.43.0-wmf.13/includes/specialpage/SpecialPageFactory.php(1693): MediaWiki\SpecialPage\SpecialPage->run(NULL)
#3 /srv/mediawiki/php-1.43.0-wmf.13/includes/actions/ActionEntryPoint.php(502): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#4 /srv/mediawiki/php-1.43.0-wmf.13/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#5 /srv/mediawiki/php-1.43.0-wmf.13/includes/MediaWikiEntryPoint.php(200): MediaWiki\Actions\ActionEntryPoint->execute()
#6 /srv/mediawiki/php-1.43.0-wmf.13/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#7 /srv/mediawiki/w/index.php(3): require(string)
#8 {main}
Impact

Logspam and, presumably, broken Special:RecentChanges on one wiki.

Notes

Almost exclusively limited to inhwiki (in the past 24 hours, 272× inh.wikipedia.org, 1× meta.wikimedia.org edit: scratch that, the metawiki error is unrelated [on rest.php and happening at a low volume since before this train]).

Details

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Special:RecentChanges with limit=184 works, limit=185 doesn’t work, so I guess the error is in the 185th row (until more edits come in) – which, if I’m not mistaken, would be this:

MariaDB [inhwiki_p]> SELECT * FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1 OFFSET 184\G
*************************** 1. row ***************************
        rc_id: 206968
 rc_timestamp: 20240715220448
     rc_actor: 7
 rc_namespace: 1
     rc_title: Ков:Ислам
rc_comment_id: 3
     rc_minor: 0
       rc_bot: 0
       rc_new: 0
    rc_cur_id: 2746
rc_this_oldid: 66178
rc_last_oldid: 0
      rc_type: 3
    rc_source: mw.log
 rc_patrolled: 2
        rc_ip: NULL
   rc_old_len: NULL
   rc_new_len: NULL
   rc_deleted: 0
     rc_logid: 23553
  rc_log_type: move
rc_log_action: move
    rc_params: a:2:{s:9:"4::target";s:36:"Ювцар:Моартал:Ислам";s:10:"5::noredir";s:1:"0";}
1 row in set (0,004 sec)

(The two lines right above that with LIMIT 3 OFFSET 182 also seem to match the last two lines I can see on the web with limit=184.)

Of note: the Моартал namespace mentioned there was introduced yesterday (T326089).

Well, I think I know where the null comes from:

class MoveLogFormatter extends LogFormatter {
	public function getPreloadTitles() {
		$params = $this->extractParameters();

		return [ Title::newFromText( $params[3] ) ];
	}
lucaswerkmeister-wmde@deploy1002 ~ $ mw-debug-repl inhwiki
Becoming root...
Finding a mw-debug pod in eqiad...
Now running shell.php for inhwiki inside pod/mw-debug.eqiad.pinkunicorn-64b79596d8-cp4qh...
Psy Shell v0.12.3 (PHP 7.4.33 — cli) by Justin Hileman
> Title::newFromText('Ювцар:Моартал:Ислам')
= null

I guess Ювцар:Моартал:Ислам (“Talk:Portal:Islam”) was a valid title before the Portal namespace was introduced, and became invalid afterwards. I’m not sure if the log entry can be fixed somehow, or if MoveLogFormatter should be more careful to not return null array elements.

Change #1055160 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/core@master] MoveLogFormatter::getPreloadTitles: Handle bad titles

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

Change #1055160 merged by jenkins-bot:

[mediawiki/core@master] MoveLogFormatter::getPreloadTitles: Handle bad titles

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

Thanks for the first fix! Though while this seems to have reduced the number of instances of this problem, it is still occurring.

image.png (288×554 px, 12 KB)

See: https://logstash.wikimedia.org/goto/892a604b8044f56bfb9c3b2e0cc6aa84

The patch hasn’t been rolled out with the train yet; I think the decrease in errors is just because as the specific affected recentchanges row gets older and older, it’s shown less often.

Change #1056155 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/core@wmf/1.43.0-wmf.14] MoveLogFormatter::getPreloadTitles: Handle bad titles

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

Change #1056155 merged by jenkins-bot:

[mediawiki/core@wmf/1.43.0-wmf.14] MoveLogFormatter::getPreloadTitles: Handle bad titles

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

Mentioned in SAL (#wikimedia-operations) [2024-07-23T13:47:46Z] <logmsgbot> lucaswerkmeister-wmde@deploy1002 Started scap sync-world: Backport for [[gerrit:1056155|MoveLogFormatter::getPreloadTitles: Handle bad titles (T370396)]]

Mentioned in SAL (#wikimedia-operations) [2024-07-23T13:51:43Z] <logmsgbot> lucaswerkmeister-wmde@deploy1002 lucaswerkmeister-wmde: Backport for [[gerrit:1056155|MoveLogFormatter::getPreloadTitles: Handle bad titles (T370396)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-07-23T13:57:10Z] <logmsgbot> lucaswerkmeister-wmde@deploy1002 Finished scap: Backport for [[gerrit:1056155|MoveLogFormatter::getPreloadTitles: Handle bad titles (T370396)]] (duration: 09m 24s)

Thank you for the backport! 🙏 Logstash looks good so far.