Page MenuHomePhabricator

OATHAuth doing DB master queries on HTTP GET
Closed, ResolvedPublic

Description

Lots of log spam from OAUTHAuth:

Expectation (masterConns <= 0) by MediaWiki::main not met:
[connect to 10.64.16.30 (centralauth)]
TransactionProfiler.php line 311 calls wfBacktrace()
TransactionProfiler.php line 146 calls TransactionProfiler->reportExpectationViolated()
LoadBalancer.php line 576 calls TransactionProfiler->recordConnection()
OATHUserRepository.php line 11 calls LoadBalancer->getConnection()
OATHAuth.hooks.php line 20 calls OATHUserRepository->__construct()
SpecialOATH.php line 14 calls OATHAuthHooks::getOATHUserRepository()
ProxySpecialPage.php line 28 calls SpecialOATH->getTargetPage()
ProxySpecialPage.php line 192 calls ProxySpecialPage->init()
SpecialPageFactory.php line 459 calls ProxySpecialPage->setContext()
SpecialSpecialpages.php line 53 calls SpecialPageFactory::getUsablePages()
SpecialSpecialpages.php line 42 calls SpecialSpecialpages->getPageGroups()
SpecialPage.php line 479 calls SpecialSpecialpages->execute()
SpecialPageFactory.php line 591 calls SpecialPage->run()
MediaWiki.php line 282 calls SpecialPageFactory::executePath()
MediaWiki.php line 746 calls MediaWiki->performRequest()
MediaWiki.php line 520 calls MediaWiki->main()
index.php line 43 calls MediaWiki->run()
index.php line 3 calls include()

Event Timeline

@aaron, is there a way to see the actual request causing this? It must be for Special:OATH, but more details would be helpful.

In kibana:

channel:DBPerformance +message:*OATH*

Ah, I see.

In OATHUserRepository::__construct we setup $this->dbw unnecessarily. We should keep a reference to the LOadBlancer, and have persist() and remove() get the connection when called.

Change 291987 had a related patch set uploaded (by Aaron Schulz):
Avoid DB connections on OATHUserRepository construction

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

Change 291987 merged by jenkins-bot:
Avoid DB connections on OATHUserRepository construction

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