Page MenuHomePhabricator

WikiModule preload should not create foreign db connection
Closed, ResolvedPublic

Description

Screen Shot 2017-03-27 at 16.20.14.png (826×792 px, 193 KB)

  • 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

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 Medium priority.Mar 28 2017, 11:05 PM
Krinkle moved this task from Inbox, needs triage to Doing (old) 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