Page MenuHomePhabricator

AbuseFilter call to User::newSystemUser on frwiki causing slow DB queries
Closed, DuplicatePublic

Description

The query to lookup if the AbuseFilter system has passwords set is slow on frwiki.

Logstash information
message
Expectation (readQueryTime <= 5) by ApiMain::setRequestExpectations not met (actual: 6.7507610321045) in trx #8a866e2f1e:
SELECT user_password FROM `user` WHERE user_name = 'X' LIMIT N
trace
from /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/TransactionProfiler.php(525)
#0 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/TransactionProfiler.php(334): Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated(string, Wikimedia\Rdbms\GeneralizedSql, double, string, string)
#1 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/TransactionManager.php(615): Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, double, boolean, integer, string, string)
#2 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(828): Wikimedia\Rdbms\TransactionManager->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, double, boolean, integer, string)
#3 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(716): Wikimedia\Rdbms\Database->attemptQuery(Wikimedia\Rdbms\Query, string, boolean)
#4 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(643): Wikimedia\Rdbms\Database->executeQuery(Wikimedia\Rdbms\Query, string, integer)
#5 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(1350): Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#6 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(1359): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->selectRow(array, array, array, string, array, array)
#8 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/DBConnRef.php(369): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#9 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(771): Wikimedia\Rdbms\DBConnRef->selectRow(array, array, array, string, array, array)
#10 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php(172): Wikimedia\Rdbms\SelectQueryBuilder->fetchRow()
#11 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/AuthManager.php(925): MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider->testUserCanAuthenticate(string)
#12 /srv/mediawiki/php-1.42.0-wmf.14/includes/user/User.php(2275): MediaWiki\Auth\AuthManager->userCanAuthenticate(string)
#13 /srv/mediawiki/php-1.42.0-wmf.14/includes/user/User.php(860): MediaWiki\User\User->isSystemUser()
#14 /srv/mediawiki/php-1.42.0-wmf.14/extensions/AbuseFilter/includes/FilterUser.php(57): MediaWiki\User\User::newSystemUser(string, array)
#15 /srv/mediawiki/php-1.42.0-wmf.14/extensions/AbuseFilter/includes/FilterUser.php(48): MediaWiki\Extension\AbuseFilter\FilterUser->getUser()
#16 /srv/mediawiki/php-1.42.0-wmf.14/extensions/AbuseFilter/includes/Hooks/Handlers/CheckUserHandler.php(86): MediaWiki\Extension\AbuseFilter\FilterUser->getUserIdentity()
#17 /srv/mediawiki/php-1.42.0-wmf.14/includes/HookContainer/HookContainer.php(161): MediaWiki\Extension\AbuseFilter\Hooks\Handlers\CheckUserHandler->onCheckUserInsertPrivateEventRow(string, string, array, MediaWiki\User\User, NULL)
#18 /srv/mediawiki/php-1.42.0-wmf.14/extensions/CheckUser/src/Hook/HookRunner.php(80): MediaWiki\HookContainer\HookContainer->run(string, array)
#19 /srv/mediawiki/php-1.42.0-wmf.14/extensions/CheckUser/src/Hooks.php(333): MediaWiki\CheckUser\Hook\HookRunner->onCheckUserInsertPrivateEventRow(string, string, array, MediaWiki\User\User, NULL)
#20 /srv/mediawiki/php-1.42.0-wmf.14/extensions/CheckUser/src/Hooks.php(721): MediaWiki\CheckUser\Hooks::insertIntoCuPrivateEventTable(array, string, MediaWiki\User\User)
#21 /srv/mediawiki/php-1.42.0-wmf.14/includes/HookContainer/HookContainer.php(161): MediaWiki\CheckUser\Hooks->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, MediaWiki\User\User, string, array)
#22 /srv/mediawiki/php-1.42.0-wmf.14/includes/HookContainer/HookRunner.php(890): MediaWiki\HookContainer\HookContainer->run(string, array)
#23 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/AuthManager.php(826): MediaWiki\HookContainer\HookRunner->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, MediaWiki\User\User, string, array)
#24 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/AuthManager.php(489): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#25 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiClientLogin.php(102): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#26 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiMain.php(1935): ApiClientLogin->execute()
#27 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiMain.php(912): ApiMain->executeAction()
#28 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiMain.php(883): ApiMain->executeActionWithErrorHandling()
#29 /srv/mediawiki/php-1.42.0-wmf.14/api.php(95): ApiMain->execute()
#30 /srv/mediawiki/php-1.42.0-wmf.14/api.php(48): wfApiMain()
#31 /srv/mediawiki/w/api.php(3): require(string)
#32 {main}
message
Expectation (readQueryTime <= 5) by ApiMain::setRequestExpectations not met (actual: 5.7005031108856) in trx #72d563215a:
SELECT user_newpassword,user_newpass_time FROM `user` WHERE user_name = 'X' LIMIT N
trace
from /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/TransactionProfiler.php(525)
#0 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/TransactionProfiler.php(334): Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated(string, Wikimedia\Rdbms\GeneralizedSql, double, string, string)
#1 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/TransactionManager.php(615): Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, double, boolean, integer, string, string)
#2 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(828): Wikimedia\Rdbms\TransactionManager->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, double, boolean, integer, string)
#3 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(716): Wikimedia\Rdbms\Database->attemptQuery(Wikimedia\Rdbms\Query, string, boolean)
#4 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(643): Wikimedia\Rdbms\Database->executeQuery(Wikimedia\Rdbms\Query, string, integer)
#5 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(1350): Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#6 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/Database.php(1359): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->selectRow(array, array, array, string, array, array)
#8 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/database/DBConnRef.php(369): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#9 /srv/mediawiki/php-1.42.0-wmf.14/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(771): Wikimedia\Rdbms\DBConnRef->selectRow(array, array, array, string, array, array)
#10 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php(198): Wikimedia\Rdbms\SelectQueryBuilder->fetchRow()
#11 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/AuthManager.php(925): MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider->testUserCanAuthenticate(string)
#12 /srv/mediawiki/php-1.42.0-wmf.14/includes/user/User.php(2275): MediaWiki\Auth\AuthManager->userCanAuthenticate(string)
#13 /srv/mediawiki/php-1.42.0-wmf.14/includes/user/User.php(860): MediaWiki\User\User->isSystemUser()
#14 /srv/mediawiki/php-1.42.0-wmf.14/extensions/AbuseFilter/includes/FilterUser.php(57): MediaWiki\User\User::newSystemUser(string, array)
#15 /srv/mediawiki/php-1.42.0-wmf.14/extensions/AbuseFilter/includes/FilterUser.php(48): MediaWiki\Extension\AbuseFilter\FilterUser->getUser()
#16 /srv/mediawiki/php-1.42.0-wmf.14/extensions/AbuseFilter/includes/Hooks/Handlers/CheckUserHandler.php(86): MediaWiki\Extension\AbuseFilter\FilterUser->getUserIdentity()
#17 /srv/mediawiki/php-1.42.0-wmf.14/includes/HookContainer/HookContainer.php(161): MediaWiki\Extension\AbuseFilter\Hooks\Handlers\CheckUserHandler->onCheckUserInsertPrivateEventRow(string, string, array, MediaWiki\User\User, NULL)
#18 /srv/mediawiki/php-1.42.0-wmf.14/extensions/CheckUser/src/Hook/HookRunner.php(80): MediaWiki\HookContainer\HookContainer->run(string, array)
#19 /srv/mediawiki/php-1.42.0-wmf.14/extensions/CheckUser/src/Hooks.php(333): MediaWiki\CheckUser\Hook\HookRunner->onCheckUserInsertPrivateEventRow(string, string, array, MediaWiki\User\User, NULL)
#20 /srv/mediawiki/php-1.42.0-wmf.14/extensions/CheckUser/src/Hooks.php(721): MediaWiki\CheckUser\Hooks::insertIntoCuPrivateEventTable(array, string, MediaWiki\User\User)
#21 /srv/mediawiki/php-1.42.0-wmf.14/includes/HookContainer/HookContainer.php(161): MediaWiki\CheckUser\Hooks->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, MediaWiki\User\User, string, array)
#22 /srv/mediawiki/php-1.42.0-wmf.14/includes/HookContainer/HookRunner.php(890): MediaWiki\HookContainer\HookContainer->run(string, array)
#23 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/AuthManager.php(826): MediaWiki\HookContainer\HookRunner->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, MediaWiki\User\User, string, array)
#24 /srv/mediawiki/php-1.42.0-wmf.14/includes/auth/AuthManager.php(489): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#25 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiClientLogin.php(102): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#26 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiMain.php(1935): ApiClientLogin->execute()
#27 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiMain.php(912): ApiMain->executeAction()
#28 /srv/mediawiki/php-1.42.0-wmf.14/includes/api/ApiMain.php(883): ApiMain->executeActionWithErrorHandling()
#29 /srv/mediawiki/php-1.42.0-wmf.14/api.php(95): ApiMain->execute()
#30 /srv/mediawiki/php-1.42.0-wmf.14/api.php(48): wfApiMain()
#31 /srv/mediawiki/w/api.php(3): require(string)
#32 {main}