Page MenuHomePhabricator

GlobalUsage breaks on db- and api-filerepo files in newest 1.19 (last tested with 1.19alpha r97000)
Closed, ResolvedPublic

Description

This bug was not yet present a few days ago. Any call to a file that comes from a global repo results in:

Fatal error: Call to undefined method GlobalUsageQuery::execute() in /usr/share/mediawikistaging/extensions/GlobalUsage/GlobalUsageImagePageHooks.php on line 17

http://biowikifarm.net/test/File:Test-lossless-rotation.JPG


Version: unspecified
Severity: normal

Details

Reference
bz30641

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 21 2014, 11:49 PM
bzimport added a project: GlobalUsage.
bzimport set Reference to bz30641.
bzimport added a subscriber: Unknown Object (MLST).

Bryan.TongMinh wrote:

That is due to the merger of the iwtransclusion branch I think. Mark, can you get somebody who knows about iwtransclusion to look at it? It sounds like a scaptrap for 1.19 deployment on WMF.

I did update to newest trunk 1.19alpha (r96144) to see whether I can close this bug.

Now, while the version is running, when referring to a file from our shared repo, it crashes. This behaviour is new, it did not occurr with the newest SVN-trunk as of 2011-08-30 21:19:51 UTC.

EXAMPLE:
http://biowikifarm.net/test/File:Test-lossless-rotation.JPG

results in:


Notice: Undefined index: DEFAULT in /usr/share/mediawikistaging/phase3/includes/db/LBFactory_Multi.php on line 115

Warning: Invalid argument supplied for foreach() in /usr/share/mediawikistaging/phase3/includes/db/LBFactory_Multi.php on line 194
Internal error
Empty server array given to LoadBalancer
Backtrace:
#0 /usr/share/mediawikistaging/phase3/includes/db/LoadBalancer.php(470): LoadBalancer->getReaderIndex(false, '')
#1 /usr/share/mediawikistaging/phase3/includes/GlobalFunctions.php(3205): LoadBalancer->getConnection(-1, Array, '')
#2 /usr/share/mediawikistaging/phase3/includes/GlobalUsageQuery.php(21): wfGetDB(-1, Array, '')
#3 /usr/share/mediawikistaging/extensions/GlobalUsage/GlobalUsageImagePageHooks.php(15): GlobalUsageQuery->__construct(Object(Title))
#4 /usr/share/mediawikistaging/extensions/GlobalUsage/GlobalUsageImagePageHooks.php(107): GlobalUsageImagePageHooks::getImagePageQuery(Object(Title))
#5 /usr/share/mediawikistaging/extensions/GlobalUsage/GlobalUsageImagePageHooks.php(74): GlobalUsageImagePageHooks::hasResults(Object(ImagePage))
#6 [internal function]: GlobalUsageImagePageHooks::onImagePageShowTOC(Object(ImagePage), Array)
#7 /usr/share/mediawikistaging/phase3/includes/Hooks.php(216): call_user_func_array('GlobalUsageImag...', Array)
#8 /usr/share/mediawikistaging/phase3/includes/GlobalFunctions.php(3630): Hooks::run('ImagePageShowTO...', Array)
#9 /usr/share/mediawikistaging/phase3/includes/ImagePage.php(208): wfRunHooks('ImagePageShowTO...', Array)
#10 /usr/share/mediawikistaging/phase3/includes/ImagePage.php(118): ImagePage->showTOC(true)
#11 /usr/share/mediawikistaging/phase3/includes/Wiki.php(466): ImagePage->view()
#12 /usr/share/mediawikistaging/phase3/includes/Wiki.php(237): MediaWiki->performAction(Object(ImagePage))
#13 /usr/share/mediawikistaging/phase3/includes/Wiki.php(622): MediaWiki->performRequest()
#14 /usr/share/mediawikistaging/phase3/includes/Wiki.php(529): MediaWiki->main()
#15 /usr/share/mediawikistaging/phase3/index.php(58): MediaWiki->run()

#16 {main}

Not sure this has something to do with GlobalUsage, it only refers to the variable set up to make GlobalUsage possible. With the following setting of $wgLBFactoryConf / class 'LBFactory_Multi', GlobalUsage does save into a shared table (although the user interface seems broken).

Trying to use LoadBalancer, to become able to run Extension:GlobalUsage, based on http://noc.wikimedia.org/conf/highlight.php?file=db.php

$wgLBFactoryConf = array(
'class' => 'LBFactory_Multi',
'sectionsByDB' => array(
'enwiki' => 's1',
'ispiwiki' => 's1',
'k2n_handbook' => 's1',
'k2n_it' => 's1',
'k2n_sl' => 's1',
'k2n_wiki' => 's1',
'liaswiki' => 's1',
'malesiana_wiki' => 's1',
'metawiki' => 's1',
'nnvmwiki' => 's1',
'onwiki' => 's1',
'openmedia' => 's1',
'orowiki' => 's1',
'plantnet_terms_en' => 's1',
'plantnet_terms_fr' => 's1',
'plantnet_uses_en' => 's1',
'plantnet_uses_fr' => 's1',
'plazi_wiki' => 's1',
'pmedwiki' => 's1',
'rosawiki' => 's1',
'specialmedia' => 's1',
'specieswiki' => 's1',
'species_fr' => 's1',
'studienstiftungswiki' => 's1',
'testwiki' => 's1',
'testwiki2' => 's1',
'wbwiki' => 's1',
'zsm_entomology' => 's1'
),
'sectionLoads' => array('s1' => array('db1' => 100,),),
'serverTemplate' => array(

'dbname'      => $wgDBname,
'user'        => $wgDBuser,
'password'    => $wgDBpassword,
'type'        => 'mysql',
'flags'       => DBO_DEFAULT,
'max lag'     => 30,
#'max threads' => 350, -- disabled TS

),
'groupLoadsBySection' => array(),
'groupLoadsByDB' => array(),
'hostsByName' => array('db1' => 'localhost',),
'externalLoads' => array(),
'masterTemplateOverrides' => array(),
'externalTemplateOverrides' => array(),
'templateOverridesByCluster' => array(),
'readOnlyBySection' => array( /* s1' => 'Emergency maintenance in progress', */ ),
);

Just an update: 1.19 still completely broken in 1.19alpha (r96692)

e.g. http://biowikifarm.net/test/File:Test-lossless-rotation.JPG

Comment #2 and the error I see at the link in comment #3 sound like a misconfigured 'sectionLoads'. You should have 'DEFAULT' as one of the sections as far as I know.

Also...I'm not entirely sure why you're using the LoadBalancer. Unless I'm missing something in your above config, all of your DBs are in the same "cluster" and those are all being served via localhost.

Many thanks for the suggestion! I did add the 'DEFAULT' as in:

'sectionLoads' => array('DEFAULT' => array('db1' => 100,),'s1' => array('db1' => 100,),),

and this indeed changes the bug (in 1.19alpha (r96692)) to something that seems GlobalUsage specific:

Fatal error: Call to undefined method GlobalUsageQuery::execute() in /usr/share/mediawikistaging/extensions/GlobalUsage/GlobalUsageImagePageHooks.php on line 17

(In reply to comment #4)

Also...I'm not entirely sure why you're using the LoadBalancer. Unless I'm
missing something in your above config, all of your DBs are in the same
"cluster" and those are all being served via localhost.

Because of Bug 30571 - GlobalUsage requires a dummy LoadBalancer config. We would prefer without the Dummy-$wgLBFactoryConf, but GlobalUsage would be extremely important to us to get working.

(In reply to comment #5)

Many thanks for the suggestion! I did add the 'DEFAULT' as in:

'sectionLoads' => array('DEFAULT' => array('db1' => 100,),'s1' => array('db1'

> 100,),),

and this indeed changes the bug (in 1.19alpha (r96692)) to something that seems
GlobalUsage specific:

Fatal error: Call to undefined method GlobalUsageQuery::execute() in
/usr/share/mediawikistaging/extensions/GlobalUsage/GlobalUsageImagePageHooks.php
on line 17

I really don't see how you could get an undefined method error, I see it clear as day in GlobalUsageQuery[0]. Can you open the file and confirm that the method is indeed there? If it's not, it sounds like you might've gotten an incomplete update--missed a file or two.

[0] http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/GlobalUsage/GlobalUsageQuery.php?view=annotate#l108

Code seems to be intact, same problem after deleting and svn re-checkout.

However, I now found out that the error only happens for images that come from a repository.

http://biowikifarm.net/test/File:273px-Quercus_cerris_folliage.jpg is native and works ok.

http://biowikifarm.net/test/File:Test-lossless-rotation.JPG comes from http://species-id.net/openmedia/File:Test-lossless-rotation.JPG which runs under 1.18alpha (r96692)

http://biowikifarm.net/test/File:Abama-twig.jpg comes from http://commons.wikimedia.org/wiki/File:Abama-twig.jpg which runs 1.17wmf.

Is such an incompatibility between version unavoidable? Until now, it was possible to test the trunk version using the repo in a stable version.

Closing, problem is gone in newest trunk 1.19alpha (r100522)