Page MenuHomePhabricator

PHP Warning: filemtime(): stat failed for /srv/mediawiki/php-1.31.0-wmf.7/extensions/MobileFronten
Closed, DeclinedPublicPRODUCTION ERROR

Description

The following is taken from https://logstash.wikimedia.org/app/kibana#/dashboard/Reading-Web

The issue appears to impact wikitech.wikimedia.org and no other domains

logstash url

{"id":"650e07caac881828845adb79","type":"ErrorException","file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/utils/FileContentsHasher.php","line":57,"message":"PHP Warning: filemtime(): stat failed for /srv/mediawiki/php-1.31.0-wmf.7/extensions/MobileFrontend/minerva.less/minerva.mixins.less","code":0,"url":"/w/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=vector","caught_by":"mwe_handler","suppressed":true,"backtrace":[{"function":"handleError","class":"MWExceptionHandler","type":"::","args":["integer","string","string","integer","array"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/utils/FileContentsHasher.php","line":57,"function":"filemtime","args":["string"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/utils/FileContentsHasher.php","line":99,"function":"getFileContentsHashInternal","class":"FileContentsHasher","type":"->","args":["string","string"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderModule.php","line":1090,"function":"getFileContentsHash","class":"FileContentsHasher","type":"::","args":["string"]},{"function":"safeFileHash","class":"ResourceLoaderModule","type":"->","args":["string"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderFileModule.php","line":542,"function":"array_map","args":["array","array"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderFileModule.php","line":580,"function":"getFileHashes","class":"ResourceLoaderFileModule","type":"->","args":["DerivativeResourceLoaderContext"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderModule.php","line":844,"function":"getDefinitionSummary","class":"ResourceLoaderFileModule","type":"->","args":["DerivativeResourceLoaderContext"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoader.php","line":667,"function":"getVersionHash","class":"ResourceLoaderModule","type":"->","args":["DerivativeResourceLoaderContext"]},{"function":"{closure}","class":"ResourceLoader","type":"->","args":["string"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoader.php","line":680,"function":"array_map","args":["Closure","array"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderStartUpModule.php","line":434,"function":"getCombinedVersion","class":"ResourceLoader","type":"->","args":["DerivativeResourceLoaderContext","array"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderStartUpModule.php","line":407,"function":"getAllModuleHashes","class":"ResourceLoaderStartUpModule","type":"->","args":["DerivativeResourceLoaderContext"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoaderModule.php","line":844,"function":"getDefinitionSummary","class":"ResourceLoaderStartUpModule","type":"->","args":["DerivativeResourceLoaderContext"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoader.php","line":667,"function":"getVersionHash","class":"ResourceLoaderModule","type":"->","args":["ResourceLoaderContext"]},{"function":"{closure}","class":"ResourceLoader","type":"->","args":["string"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoader.php","line":680,"function":"array_map","args":["Closure","array"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/includes/resourceloader/ResourceLoader.php","line":762,"function":"getCombinedVersion","class":"ResourceLoader","type":"->","args":["ResourceLoaderContext","array"]},{"file":"/srv/mediawiki/php-1.31.0-wmf.7/load.php","line":53,"function":"respond","class":"ResourceLoader","type":"->","args":["ResourceLoaderContext"]},{"file":"/srv/mediawiki/w/load.php","line":3,"args":["string"],"function":"require"}]}

Event Timeline

Krinkle subscribed.

The error happens as intended. The module was referring to a file, that does not currently exist on disk.

PHP Warning: filemtime(): stat failed for /srv/mediawiki/php-1.31.0-wmf.7/extensions/MobileFrontend/minerva.less/minerva.mixins.less

Note that this error has suppressed: true and should not be concern in any way. This happens by design in ResourceLoader and, unless an actual issue is observed on Wikitech, this is presumably all working fine.

As for why this file is checked by ResourceLoader: When generating the startup module ResourceLoader will iterate over each module in the system to produce a version hash. In the case of style modules that use LESS, the less compiler is avoided given that it would be too slow to invoke for 100-1000 of modules in a single response. Instead, ResourceLoader will check only the files references in the module definition (e.g. in extension.json). This however is not sufficient to detect changes after a deployment because, for example, if you change an SVG image referenced from a CSS file, the path to that SVG will not be in the array of files that define the module. This is why ResourceLoader stores a list of file paths that were used during the last CSS and LESS parsing, which is cached, and then checked by the startup module in addition to the top-level files that define the module.

If any of the top-level files, or the indirect files used, are changed or were removed, that means a change was made and the module cache should be invalidated and then re-generated.

This means that after a deployment that removes a file (in an otherwise clean and non-breaking way), ResourceLoader will sometimes end up looking for a file that doesn't exist anymore. This is by design, and is exactly why the internal PHP error is suppressed.

Do you find the error is happening persistently for a long period of time? Or only for 5-10 minutes post-deploy?

It does look like it could be deploy related. Spikes were on 3rd Nov and 10th Nov but only happened in the last 2 deploys.

Per https://phabricator.wikimedia.org/T180637#3764843 and the infrequence of this error I think we can decline this.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM