GrowthExperiments\WelcomeSurveyHooks->onCentralAuthPostLoginRedirect does write on GET
Closed, ResolvedPublicBUG REPORT

Description

Logstash: https://logstash.wikimedia.org/goto/4329483df25ad32e391b4a09093365e3

Expectation (masterConns <= 0) by MediaWiki::main not met (actual: 2):
[connect to db1136 (centralauth)]
from /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/TransactionProfiler.php(467)
#0 /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/TransactionProfiler.php(222): Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated(string, string, integer)
#1 /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/loadbalancer/LoadBalancer.php(980): Wikimedia\Rdbms\TransactionProfiler->recordConnection(string, string, boolean)
#2 /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/loadbalancer/LoadBalancer.php(941): Wikimedia\Rdbms\LoadBalancer->getServerConnection(integer, string, integer)
#3 /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(95): Wikimedia\Rdbms\LoadBalancer->getConnectionInternal(integer, array, string, integer)
#4 /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(101): Wikimedia\Rdbms\DBConnRef->ensureConnection()
#5 /srv/mediawiki/php-1.39.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(351): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/User/CentralAuthUser.php(564): Wikimedia\Rdbms\DBConnRef->selectRow(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/User/CentralAuthUser.php(452): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->loadFromDatabase()
#8 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/User/CentralAuthUser.php(737): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->loadState()
#9 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/CentralAuthHooks.php(486): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->isAttached()
#10 /srv/mediawiki/php-1.39.0-wmf.26/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\CentralAuth\CentralAuthHooks->onUserSaveSettings(User)
#11 /srv/mediawiki/php-1.39.0-wmf.26/includes/HookContainer/HookRunner.php(4328): MediaWiki\HookContainer\HookContainer->run(string, array)
#12 /srv/mediawiki/php-1.39.0-wmf.26/includes/user/UserOptionsManager.php(398): MediaWiki\HookContainer\HookRunner->onUserSaveSettings(User)
#13 /srv/mediawiki/php-1.39.0-wmf.26/extensions/GrowthExperiments/includes/WelcomeSurvey.php(336): MediaWiki\User\UserOptionsManager->saveOptions(User)
#14 /srv/mediawiki/php-1.39.0-wmf.26/extensions/GrowthExperiments/includes/WelcomeSurvey.php(376): GrowthExperiments\WelcomeSurvey->saveSurveyData(array)
#15 /srv/mediawiki/php-1.39.0-wmf.26/extensions/GrowthExperiments/includes/WelcomeSurveyHooks.php(124): GrowthExperiments\WelcomeSurvey->saveGroup(string)
#16 /srv/mediawiki/php-1.39.0-wmf.26/includes/HookContainer/HookContainer.php(160): GrowthExperiments\WelcomeSurveyHooks->onCentralAuthPostLoginRedirect(string, string, boolean, string, string)
#17 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/Hooks/CentralAuthHookRunner.php(54): MediaWiki\HookContainer\HookContainer->run(string, array)
#18 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/Special/SpecialCentralLogin.php(333): MediaWiki\Extension\CentralAuth\Hooks\CentralAuthHookRunner->onCentralAuthPostLoginRedirect(string, string, boolean, string, string)
#19 /srv/mediawiki/php-1.39.0-wmf.26/extensions/CentralAuth/includes/Special/SpecialCentralLogin.php(90): MediaWiki\Extension\CentralAuth\Special\SpecialCentralLogin->doLoginComplete(string)
#20 /srv/mediawiki/php-1.39.0-wmf.26/includes/specialpage/SpecialPage.php(701): MediaWiki\Extension\CentralAuth\Special\SpecialCentralLogin->execute(string)
#21 /srv/mediawiki/php-1.39.0-wmf.26/includes/specialpage/SpecialPageFactory.php(1426): SpecialPage->run(string)
#22 /srv/mediawiki/php-1.39.0-wmf.26/includes/MediaWiki.php(316): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#23 /srv/mediawiki/php-1.39.0-wmf.26/includes/MediaWiki.php(905): MediaWiki->performRequest()
#24 /srv/mediawiki/php-1.39.0-wmf.26/includes/MediaWiki.php(562): MediaWiki->main()
#25 /srv/mediawiki/php-1.39.0-wmf.26/index.php(50): MediaWiki->run()
#26 /srv/mediawiki/php-1.39.0-wmf.26/index.php(46): wfIndexMain()
#27 /srv/mediawiki/w/index.php(3): require(string)
#28 {main}

Also a bunch of Expectation (writes <= 0) by MediaWiki::main not met (actual: 1) errors, with similar stack traces (minus the CentralAuth part).

I'm not sure why/how CentralAuth is involved in this, but probably we should make sure that the survey group is recorded immediately on registration and not during the redirect.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 826774 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] Fix WelcomeSurvey CentralAuthPostLoginRedirect hook

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

Tgr triaged this task as High priority.

Change 827191 had a related patch set uploaded (by Kosta Harlan; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@wmf/1.39.0-wmf.26] Fix WelcomeSurvey CentralAuthPostLoginRedirect hook

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

Change 827191 abandoned by Kosta Harlan:

[mediawiki/extensions/GrowthExperiments@wmf/1.39.0-wmf.26] Fix WelcomeSurvey CentralAuthPostLoginRedirect hook

Reason:

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

Change 826774 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Fix WelcomeSurvey CentralAuthPostLoginRedirect hook

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

Change 827191 restored by Gergő Tisza:

[mediawiki/extensions/GrowthExperiments@wmf/1.39.0-wmf.26] Fix WelcomeSurvey CentralAuthPostLoginRedirect hook

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

Change 827191 merged by Clare Ming:

[mediawiki/extensions/GrowthExperiments@wmf/1.39.0-wmf.26] Fix WelcomeSurvey CentralAuthPostLoginRedirect hook (step 1)

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

Mentioned in SAL (#wikimedia-operations) [2022-08-29T21:01:33Z] <cjming@deploy1002> Synchronized php-1.39.0-wmf.26/extensions/GrowthExperiments/includes/WelcomeSurveyHooks.php: Backport: [[gerrit:827191|Fix WelcomeSurvey CentralAuthPostLoginRedirect hook (step 1) (T315583 T316311)]] (duration: 03m 36s)

Etonkovidova subscribed.

Checked - the issue is not present; the last timestamp - Aug 29, 2022 @ 21:00:27.563 (logstash link