Page MenuHomePhabricator

File description page should be purged after deleting file
Open, Needs TriagePublic

Description

Filepage not purged after deletion (for a random example see file)

purgeerror.JPG (636×1 px, 101 KB)

(File has been deleted at 00:17, 3 July 2015 but hours later not purged!)

Event Timeline

Steinsplitter raised the priority of this task from to Needs Triage.
Steinsplitter updated the task description. (Show Details)
Steinsplitter subscribed.
Steinsplitter set Security to None.
Steinsplitter moved this task from Incoming to Backlog on the Commons board.
Aklapper renamed this task from Purging file page after deletion to File page not purged after deletion.Jul 16 2015, 2:21 PM

I have the same problem. We use redis as the main cache. MediaWiki 1.29

Several images were deleted normally by the web interface. However, one of them is stuck: The file is deleted (it's not on the public folder anymore) and it's not on the database neither (image table). However, viewing the file description page displays the image, the deletion log and the file revision log. Purging the page does not work.

T104711-wpage.png (823×876 px, 147 KB)

(image is displayed because I have a CDN with long TTL)

I can even delete it again (although there's no delete button, I can access action=delete and perform the deletion again without errors):

T104711-wdel.png (485×732 px, 41 KB)

Doing an imageinfo query api I get

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "-1": {
                "ns": 6,
                "title": "Archivo:Al ataque fase 1 XY.png",
                "missing": "",
                "known": "",
                "imagerepository": "",
                "contentmodel": "wikitext",
                "pagelanguage": "es",
                "pagelanguagehtmlcode": "es",
                "pagelanguagedir": "ltr"
            }
        }
    }
}

Nothing in DB

MariaDB [wikidexwiki]> select * from image where img_name = 'Al_ataque_fase_1_XY.png';
Empty set (0.00 sec)

I've found that the image info is on the cache, so for MediaWiki, when reading from the cache, the file is known:

$ sudo -u php-fpm-wikidex php /home/www/www.wikidex.net/mediawiki-1.29.0/maintenance/eval.php
> $t = Title::newFromText('Archivo:Al ataque fase 1 XY.png');

> $r = RepoGroup::singleton()->getLocalRepo();

> $f = LocalFile::newFromTitle($t, $r);

> $f->load( File::READ_LATEST );

> echo $f->exists();

> $f = LocalFile::newFromTitle($t, $r);

> $f->load( 0 );

> echo $f->exists();
1
> echo $f->getCacheKey();
wikidexwiki:file:03a59b1df03870911d66c5c914d70b4e8337ddf9

Deleting the file again (as I said) doesn't remove it from the cache. action=purge doesn't neither. I think both actions should try to remove it from the cache, so it can be purged from the web interface.

I can't see anything related in the error and exception logs from the deletion time. Not sure why it wasn't purged the first time. Maybe a race condition somewhere.

I've tried also to $f->invalidateCache(); (from eval.php) but it didn't remove it from the cache neither. I had to execute $r->getMasterDB()->commit(); for it to be removed, because I found LocalFile::invalidateCache purges it only on transaction commit.

	/**
	 * Purge the file object/metadata cache
	 */
	public function invalidateCache() {
		$key = $this->getCacheKey();
		if ( !$key ) {
			return;
		}

		$this->repo->getMasterDB()->onTransactionPreCommitOrIdle(
			function () use ( $key ) {
				ObjectCache::getMainWANInstance()->delete( $key );
			},
			__METHOD__
		);
	}

Maybe the bug was related to this, transaction was never commited, or who knows...

Krinkle renamed this task from File page not purged after deletion to File description page should be purged after deleting file.Dec 3 2019, 10:50 PM