jenkins-bot has submitted this change and it was merged.
Change subject: resourceloader: Write to debug log for all fatal errors
......................................................................
resourceloader: Write to debug log for all fatal errors
There's various fatal errors that can happen in ResourceLoader.
Since in a javascript/css response there is no error page we can
show, we currently catch them all and output them in a block
comment on top of load.php.
This maintains valid syntax for the response and keeps the error
easy to view (if you're looking for it in the browser).
However from a debugging perspective it is a nightmare. Literally
the only visible difference from a normal request response is
the cache maxage (if hasErrors: use unversionsed maxage).
For all errors we currently already catch and write to request
response outpout, also write to debug log.
This also helps in fixing bug #.
This commit basically changes the following pattern:
// Add exception to the output as a comment
$errors .= $this->makeComment( $e->__toString() );
$this->hasErrors = true;
to:
wfDebugLog( 'resourceloader', __METHOD__ . ": <failure summary>: $e\n" );
$this->hasErrors = true;
// Add exception to the output as a comment
$errors .= $this->makeComment( $e->__toString() );
Bug: 44018
Change-Id: I684f6492f839a6c6adb07b0640e88cfea21fcf60
---
M includes/resourceloader/ResourceLoader.php
1 file changed, 14 insertions(+), 6 deletions(-)
Approvals:
Reedy: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/resourceloader/ResourceLoader.php
b/includes/resourceloader/ResourceLoader.php
index a3c3b10..e4fd982 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -174,9 +174,10 @@
// Save filtered text to Memcached
$cache->set( $key, $result );
} catch ( Exception $exception ) {
+ wfDebugLog( 'resourceloader', __METHOD__ . ":
minification failed: $e" );
+ $this->hasErrors = true;
// Return exception as a comment
$result = $this->makeComment( $exception->__toString()
);
- $this->hasErrors = true;
}
wfProfileOut( __METHOD__ );
@@ -453,8 +454,11 @@
// Do not allow private modules to be loaded
from the web.
// This is a security issue, see bug 34907.
if ( $module->getGroup() === 'private' ) {
- $errors .= $this->makeComment( "Cannot
show private module \"$name\"" );
+ wfDebugLog( 'resourceloader',
__METHOD__ . ": request for private module denied: $e" );
$this->hasErrors = true;
+ // Add exception to the output as a
comment
+ $errors .= $this->makeComment( "Cannot
show private module \"$name\"" );
+
continue;
}
$modules[$name] = $module;
@@ -467,9 +471,10 @@
try {
$this->preloadModuleInfo( array_keys( $modules ),
$context );
} catch ( Exception $e ) {
+ wfDebugLog( 'resourceloader', __METHOD__ . ":
preloading module info failed: $e" );
+ $this->hasErrors = true;
// Add exception to the output as a comment
$errors .= $this->makeComment( $e->__toString() );
- $this->hasErrors = true;
}
wfProfileIn( __METHOD__ . '-getModifiedTime' );
@@ -485,9 +490,10 @@
// Calculate maximum modified time
$mtime = max( $mtime, $module->getModifiedTime(
$context ) );
} catch ( Exception $e ) {
+ wfDebugLog( 'resourceloader', __METHOD__ . ":
calculating maximum modified time failed: $e" );
+ $this->hasErrors = true;
// Add exception to the output as a comment
$errors .= $this->makeComment( $e->__toString()
);
- $this->hasErrors = true;
}
}
@@ -694,9 +700,10 @@
try {
$blobs = MessageBlobStore::get( $this,
$modules, $context->getLanguage() );
} catch ( Exception $e ) {
+ wfDebugLog( 'resourceloader', __METHOD__ . ":
pre-fetching blobs from MessageBlobStore failed: $e" );
+ $this->hasErrors = true;
// Add exception to the output as a comment
$exceptions .= $this->makeComment(
$e->__toString() );
- $this->hasErrors = true;
}
} else {
$blobs = array();
@@ -800,9 +807,10 @@
break;
}
} catch ( Exception $e ) {
+ wfDebugLog( 'resourceloader', __METHOD__ . ":
generating module package failed: $e" );
+ $this->hasErrors = true;
// Add exception to the output as a comment
$exceptions .= $this->makeComment(
$e->__toString() );
- $this->hasErrors = true;
// Register module as missing
$missing[] = $name;
--
To view, visit https://gerrit.wikimedia.org/r/62190
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I684f6492f839a6c6adb07b0640e88cfea21fcf60
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: Tschoffelen <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits