Page MenuHomePhabricator

Infinite loop in findMissingFiles.php
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Run the findMissingFiles.php maintenance script: php maintenance/run.php findMissingFiles

What happens?: The script checks through the same handful of files over and over again. It doesn't get to every file, and the script never halts.

What should have happened instead?: The script should check every file exactly once.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia): MediaWiki 1.44.0

Other information (browser name/version, screenshots, etc.): I learned about this from a friend of mine who was having this issue on the wiki he hosts. When investigating this on my own wiki, I modified the findMissingFiles.php code so I could see every file it was checking:

foreach ( $pathsByName as $path ) {
	if ( $be->fileExists( [ 'src' => $path ] ) === false ) {
		$this->output( "$path\n" );
	} else { // I added this else block for debugging, it is not present in the original code
		$this->output( "$path OK!\n" );
	}
}

This modification does not cause or otherwise affect the bug.

Event Timeline

Umherirrender subscribed.

The reorder of code in 7432b218160a85219a9f9a4d76f7ba3debb206b8 within the script makes this broken when there are more files as the batch size.

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

[mediawiki/core@master] maintenance: Fix paging in findMissingFiles.php

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

Change #1175580 merged by jenkins-bot:

[mediawiki/core@master] maintenance: Fix paging in findMissingFiles.php

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

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

[mediawiki/core@REL1_44] maintenance: Fix paging in findMissingFiles.php

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

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

[mediawiki/core@REL1_43] maintenance: Fix paging in findMissingFiles.php

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

Change #1176305 merged by jenkins-bot:

[mediawiki/core@REL1_43] maintenance: Fix paging in findMissingFiles.php

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

Change #1176304 merged by jenkins-bot:

[mediawiki/core@REL1_44] maintenance: Fix paging in findMissingFiles.php

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