Page MenuHomePhabricator

Regression. Calling ObjectCache::getMainWANInstance() results in OOM with CACHE_ANYTHING MainCache on mysql
Closed, ResolvedPublic

Description

adam@adsh git/gerrit/mediawiki ((f4bf52e...))
$ php ./maintenance/eval.php
> ObjectCache::getMainWANInstance();
Fatal error: Out of memory (allocated 1413480448) (tried to allocate 262144 bytes) in git\gerrit\mediawiki\includes\db\loadbalancer\LoadBalancer.php on line 121
Fatal error: Out of memory (allocated 1413480448) (tried to allocate 262144 bytes) in Unknown on line 0

It looks like with a setting of CACHE_ANYTHING as the cache maintype and mysql as the db backend something like the below happens:

  1. Call ObjectCache::getMainWANInstance();
  2. ObjectCache::newAnything is called to get a cache which tries to use a db backend as a cache (MediaWikiServices::getInstance()->getDBLoadBalancer())
  3. The service wiring for DBLoadBalancerFactory is called which returns a new LoadBalancer instance
  4. LoadBalancer::__construct again calls ObjectCache::getMainWANInstance();

This is as a result of https://gerrit.wikimedia.org/r/#/c/300493/ which fixed T24923

This also results in any attempt to load any pages failing. git bisect shows that the above patch caused the issue.

Event Timeline

Change 302289 had a related patch set uploaded (by Addshore):
Revert "Automatically detect READ_ONLY mode for MySQL/MariaDB"

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

Addshore triaged this task as High priority.Aug 1 2016, 6:23 PM
Addshore awarded a token.

Change 302291 had a related patch set uploaded (by Addshore):
Revert "Silence the TransactionProfiler in masterRunningReadOnly()"

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

Krinkle raised the priority of this task from High to Unbreak Now!.

Change 302415 had a related patch set uploaded (by Aaron Schulz):
Avoid stack overflow in LoadBalancer with CACHE_DB WAN cache

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

Change 302289 abandoned by Addshore:
Revert "Automatically detect READ_ONLY mode for MySQL/MariaDB"

Reason:
https://gerrit.wikimedia.org/r/#/c/302415/

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

Change 302291 abandoned by Addshore:
Revert "Silence the TransactionProfiler in masterRunningReadOnly()"

Reason:
https://gerrit.wikimedia.org/r/#/c/302415/

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

Change 302415 merged by jenkins-bot:
Avoid stack overflow in LoadBalancer with CACHE_DB WAN/server cache

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

Should be fixed with the patch merged above.