https://bugzilla.wikimedia.org/show_bug.cgi?id=35962
Web browser: ---
Bug #: 35962
Summary: SMW: Crash in runJobs.php if _LEDT is enabled because
Title::getLatestRevID returns zero for existing page
Product: MediaWiki extensions
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Semantic MediaWiki
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Mobile Platform: ---
Created attachment 10420
--> https://bugzilla.wikimedia.org/attachment.cgi?id=10420
Workaround.
MediaWiki 1.18.1
SemanticMedia Wiki 1.7.1
I have never seen this issue when working with MediaWiki interactively, but
running maintenance/runJobs.php script often crashes:
Fatal error: Call to a member function getUser() on a non-object in
/var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/SMW_ParseData.php on
line 218
Call Stack:
0.0004 668472 1. {main}()
/var/www/oc.su/MediaWiki-1.18.1/maintenance/runJobs.php:0
0.0029 1239944 2.
require_once('/var/www/oc.su/MediaWiki-1.18.1/maintenance/doMaintenance.php')
/var/www/oc.su/MediaWiki-1.18.1/maintenance/runJobs.php:108
0.1163 18504696 3. RunJobs->execute()
/var/www/oc.su/MediaWiki-1.18.1/maintenance/doMaintenance.php:105
0.1813 19744368 4. RefreshLinksJob2->run()
/var/www/oc.su/MediaWiki-1.18.1/maintenance/runJobs.php:78
0.7043 39067088 5. LinksUpdate->__construct()
/var/www/oc.su/MediaWiki-1.18.1/includes/job/RefreshLinksJob.php:119
0.7048 39069280 6. wfRunHooks()
/var/www/oc.su/MediaWiki-1.18.1/includes/LinksUpdate.php:98
0.7048 39069280 7. Hooks::run()
/var/www/oc.su/MediaWiki-1.18.1/includes/GlobalFunctions.php:3631
0.7048 39084176 8. call_user_func_array()
/var/www/oc.su/MediaWiki-1.18.1/includes/Hooks.php:216
0.7048 39084512 9. SMWParseData::onLinksUpdateConstructed()
/var/www/oc.su/MediaWiki-1.18.1/includes/Hooks.php:216
0.7049 39084560 10. SMWParseData::storeData()
/var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/SMW_ParseData.php:481
(reported line numbers may be not fully correct because I added bunch of trace
statements to the code to track down the problem.)
The problem appears in SMW_ParseData.php:210:
case '_LEDT' :
$revision = Revision::newFromId( $title->getLatestRevID() );
$user = User::newFromId( $revision->getUser() );
$value = SMWDIWikiPage::newFromTitle( $user->getUserPage() );
break;
For unknown reason, getLatestRevID() returns zero for valid title of *existing*
page, $revision set to null, getUser() failed.
I am not sure if it is a bug in Title, LinkCache, BacklinkCache,
RefreshLinksJob2 classes, or in runJobs.php script.
Roughly, the scenario is:
runJobs.php calls RunJobs->execute() which calls RefreshLinksJob2->run() which
calls BacklinkCache->getLinks(). The latter gets list of pages, but only titls,
namespaces, and ids (no lastest rev id, no redirection, etc):
// @todo FIXME: Make this a function?
if ( !isset( $this->fullResultCache[$table] ) ) {
wfDebug( __METHOD__ . ": from DB\n" );
$res = $this->getDB()->select(
array( $table, 'page' ),
array( 'page_namespace', 'page_title', 'page_id' ),
// ===>>> NOTE: If I add 'page_latest' to the list,
// ===>>> the problem will disappear.
$this->getConditions( $table ),
__METHOD__,
array(
'STRAIGHT_JOIN',
'ORDER BY' => $fromField,
) );
$this->fullResultCache[$table] = $res;
}
This information is cached in LinkCache, and later returned by
$title->getLatestRevID(). I think it is obviously a bug (but do not know where
exactly).
Meanwhile, Semantic MediaWiki can be fixed to workaround it:
case '_LEDT' :
// Do *not* use
// $revision = Revision::newFromId( $title->getLatestRevID() );
// being run from maintenance/runJobs.php it causes exceptions because
// `$title->getLatestRevID()' returns zero for *existing* page.
// Not sure whether it is a MediaWiki bug or not, but using
// `Revision::newFromTitle' helps to avid this problem.
$revision = Revision::newFromTitle( $title );
$user = User::newFromId( $revision->getUser() );
$value = SMWDIWikiPage::newFromTitle( $user->getUserPage() );
break;
Revision::newFromTitle() does not rely on cache, but gets last revision id
directly from database. I should be less efficient, but works and does not
crash.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l