Page MenuHomePhabricator

mw conf cache is not properly invalidated
Closed, ResolvedPublic

Description

rOMWC9330dbd38fc8: Invalidate InitialiseSettings cache anytime config changes changed the MediaWiki configuration cache to be invalidated on a file modification time of wmfConfDir instead of InitialiseSettings.php

When using sync-file, that does not always update the parent directory, causing the cache to be stall somehow.

I noticed that while doing the 1.27.0-wmf.23 switch for group 1. We had a spam of:

Notice: Undefined variable: wmgUseUploadsLink in /srv/mediawiki/wmf-config/CommonSettings.php on line 827

I have touched and ran sync-file on InitialiseSettings.php then CommonSettings.php but the error was still going on. I then ended up reverting the perfectly legitimate patch https://gerrit.wikimedia.org/r/#/c/286517/ and sycnd it with sync-dir:

Later @Legoktm tried again, pushing the patch via sync-file. That is when I noticed CommonSettings.php no more invalidate the cache based on InitialiseSettings.php. Since rOMWC9330dbd38fc85998d8bdea67224ea4063a60d490 we have:

$filename = "/tmp/mw-cache-$wmgVersionNumber/conf-$wgDBname";
if ( defined( 'HHVM_VERSION' ) ) {
    $filename .= '-hhvm';
}

$globals = false;
if ( @filemtime( $filename ) >= filemtime( "$wmfConfigDir/." ) ) { 
    $cacheRecord = @file_get_contents( $filename );
    if ( $cacheRecord !== false ) {
        $globals = unserialize( $cacheRecord );
    }
}

@Legoktm then touched wmfConfDir, synced it and the cache got invalidated properly:

Using the directory is a very good idea, but unfortunately it does not always work. Maybe due to some file system mount option or just because it is not meant to be reliable. That is to be investigated.

Short term, the easiest is probably to revert back to InitialiseSettings.php for the invalidation.

Event Timeline

hashar created this task.May 4 2016, 9:48 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptMay 4 2016, 9:48 PM
hashar updated the task description. (Show Details)May 4 2016, 9:54 PM
demon closed this task as Resolved.May 4 2016, 9:56 PM
demon claimed this task.

Reverted.

That also might be related to HHVM hhvm.server.stat_cache=true.

From a quick glance at HHVM stat-cache.h it relies on inotify, so maybe that is an issue with the kernel version or whatever low level thing.

demon removed demon as the assignee of this task.Mar 16 2019, 3:29 PM
demon removed a subscriber: demon.Mar 16 2019, 3:32 PM
hashar closed this task as Resolved.Apr 17 2019, 1:01 PM
hashar claimed this task.

That should have been kept resolved...