Page MenuHomePhabricator

WikiModule preload should not create foreign db connection
Closed, ResolvedPublic

Description

  • load.php -> ResourceLoader::respond -> .. -> ResourceLoader::preloadModuleInfo -> ResourceLoaderWikiModule::preloadTilteInfo
  • We then iterate over the relevant modules, and only for those that have getDB() return the local database do we actually preload title info.
  • It is unexpected that, despite us intentionally ignoring the foreign database, a connection is still being opened.

<https://github.com/wikimedia/mediawiki-extensions-GlobalCssJs/blob/6f228b5f5046b011fddc5d97e487dcaa59447106/ResourceLoaderGlobalModule.php#L77-L83

extensions/GlobalCssJs/ResourceLoaderGlobalModule
return wfGetLB( $this->wiki )->getConnectionRef( DB_SLAVE, [], $this->wiki );
includes/resourceloader/WikiModule
...
			$module = $rl->getModule( $name );
			if ( $module instanceof self ) {
				$mDB = $module->getDB();
				// Subclasses may disable getDB and implement getTitleInfo differently
				if ( $mDB && $mDB->getWikiID() === $db->getWikiID() ) {

Event Timeline

Krinkle created this task.Mar 27 2017, 11:24 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 27 2017, 11:24 PM
Krinkle updated the task description. (Show Details)Mar 27 2017, 11:26 PM
aaron added a comment.Mar 28 2017, 9:46 PM

It's not a lazy handle, so this is expected (e.g. getLazyConnectionRef).

Change 345255 had a related patch set uploaded (by Aaron Schulz):
[mediawiki/extensions/GlobalCssJs@master] Use getLazyConnectionRef() in ResourceLoaderGlobalModule

https://gerrit.wikimedia.org/r/345255

Krinkle triaged this task as Normal priority.Mar 28 2017, 11:05 PM
Krinkle moved this task from Inbox to Doing on the Performance-Team board.

Change 345255 merged by jenkins-bot:
[mediawiki/extensions/GlobalCssJs@master] Use getLazyConnectionRef() in ResourceLoaderGlobalModule

https://gerrit.wikimedia.org/r/345255

aaron closed this task as Resolved.Mar 29 2017, 12:00 AM