Page MenuHomePhabricator

ChronologyProtector redirect optimization depends on inappropriate $wgLocalVirtualHosts setting
Closed, ResolvedPublic

Description

It seems $wgLocalVirtualHosts doesn't include .wikimedia.org in wmf-config/CommonSettings.php. The entry was commented out in 2008. And I'm sure there are many other reasons (more non-wikis under .wikimedia.org).

However, aside from Meta-Wiki and Wikimedia Commons, there are no other .wikimedia.org domains listed. At the very least we should probably include login.wikimedia.org.

What does this variable actually do? Two things:

DefaultSettings.php
/**
 * Local virtual hosts.
 *
 * This lists domains that are configured as virtual hosts on the same machine.
 *
 * This affects the following:
 * - MWHttpRequest: If a request is to be made to a domain listed here, or any
 *   subdomain thereof, then no proxy will be used.
 *   Command-line scripts are not affected by this setting and will always use
 *   proxy if it is configured.
 * - ChronologyProtector: Decide to shutdown LBFactory asynchronously instead
 *   synchronously if the current response redirects to a local virtual host.
 */
array $wgLocalVirtualHosts

The latter was introduced in a series of commits to both fix bugs with CentralAuth and cross-wiki redirects in some cases, as well as to improve performance in others (no needless blocking).

Given logging in involves redirects and login.wikimedia.org, I guess this might mean this code isn't running as it was intended. We should understand the impact of this not being configured as such, and (if okay) add it.

I also noticed wikidata.org notably absent from the list.

Event Timeline

We should see if there is any unrelated downside to adding login/wikidata.org. I'd imagine it would be useful for account creation on connections with high latency.

It should probably just be www.wikidata.org so it doesn't include query.wikidata.org. But otherwise this seems mostly like an accidental oversight and not intentional.

Gilles triaged this task as Low priority.
Gilles moved this task from Inbox to Next: Goal / Jan-Mar '21 on the Performance-Team board.

Another option is to have the MediaWiki.php code use InterWikiLookup::getAllPrefixes() and the 'iw_url' field for each item.

Looks like using WikiMap is the best choice IMO.

Change 373147 had a related patch set uploaded (by Aaron Schulz; owner: Aaron Schulz):
[mediawiki/core@master] Avoid DB replication waits for farm cross-wiki redirects

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

Change 373147 merged by jenkins-bot:
[mediawiki/core@master] Avoid preemptive DB replication waits for farm cross-wiki redirects

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

aaron renamed this task from $wgLocalVirtualHosts should include login.wikimedia.org, wikidata.org and others? to ChronologyProtector redirect optimization depends on inappropriate $wgLocalVirtualHosts setting.Aug 25 2017, 11:24 PM
Krinkle reassigned this task from Krinkle to aaron.
Krinkle moved this task from Blocked (old) to Doing (old) on the Performance-Team board.
Krinkle removed a project: Patch-For-Review.