Page MenuHomePhabricator

Logging in on Wikitech can throw fatal from LdapAuthentication "CAS update failed on user_touched"
Open, LowPublicPRODUCTION ERROR

Description

Error message
[6b65d3d4-97c7-4367-abc9-6a1ffae3e6ca] 2020-04-07 15:19:51: Fatal exception of type "MWException"
Impact

Login was shown to have failed, however after refreshing the page I was logged in and still at Special:UserLogin with the notice There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Please resubmit the form.

Details

Request ID
6b65d3d4-97c7-4367-abc9-6a1ffae3e6ca
Request URL
https://wikitech.wikimedia.org/w/index.php?title=Special:UserLogin
Stack Trace
#0 /srv/mediawiki/php-1.35.0-wmf.26/includes/libs/rdbms/database/Database.php(4179): User->{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#1 /srv/mediawiki/php-1.35.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure)
#2 /srv/mediawiki/php-1.35.0-wmf.26/includes/libs/rdbms/database/DBConnRef.php(641): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#3 /srv/mediawiki/php-1.35.0-wmf.26/includes/user/User.php(3974): Wikimedia\Rdbms\DBConnRef->doAtomicSection(string, Closure)
#4 /srv/mediawiki/php-1.35.0-wmf.26/extensions/LdapAuthentication/includes/LdapAuthenticationPlugin.php(1259): User->saveSettings()
#5 /srv/mediawiki/php-1.35.0-wmf.26/extensions/LdapAuthentication/includes/LdapPrimaryAuthenticationProvider.php(129): LdapAuthenticationPlugin->updateUser(User)
#6 /srv/mediawiki/php-1.35.0-wmf.26/includes/Hooks.php(174): LdapPrimaryAuthenticationProvider->onUserLoggedIn(User)
#7 /srv/mediawiki/php-1.35.0-wmf.26/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#8 /srv/mediawiki/php-1.35.0-wmf.26/includes/auth/AuthManager.php(2411): Hooks::run(string, array)
#9 /srv/mediawiki/php-1.35.0-wmf.26/includes/auth/AuthManager.php(692): MediaWiki\Auth\AuthManager->setSessionDataForUser(User, boolean)
#10 /srv/mediawiki/php-1.35.0-wmf.26/includes/auth/AuthManager.php(383): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#11 /srv/mediawiki/php-1.35.0-wmf.26/includes/specialpage/AuthManagerSpecialPage.php(354): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#12 /srv/mediawiki/php-1.35.0-wmf.26/includes/specialpage/AuthManagerSpecialPage.php(484): AuthManagerSpecialPage->performAuthenticationStep(string, array)
#13 /srv/mediawiki/php-1.35.0-wmf.26/includes/htmlform/HTMLForm.php(694): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)
#14 /srv/mediawiki/php-1.35.0-wmf.26/includes/specialpage/AuthManagerSpecialPage.php(417): HTMLForm->trySubmit()
#15 /srv/mediawiki/php-1.35.0-wmf.26/includes/specialpage/LoginSignupSpecialPage.php(317): AuthManagerSpecialPage->trySubmit()
#16 /srv/mediawiki/php-1.35.0-wmf.26/includes/specialpage/SpecialPage.php(575): LoginSignupSpecialPage->execute(NULL)
#17 /srv/mediawiki/php-1.35.0-wmf.26/includes/specialpage/SpecialPageFactory.php(618): SpecialPage->run(NULL)
#18 /srv/mediawiki/php-1.35.0-wmf.26/includes/MediaWiki.php(299): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#19 /srv/mediawiki/php-1.35.0-wmf.26/includes/MediaWiki.php(973): MediaWiki->performRequest()
#20 /srv/mediawiki/php-1.35.0-wmf.26/includes/MediaWiki.php(535): MediaWiki->main()
#21 /srv/mediawiki/php-1.35.0-wmf.26/index.php(47): MediaWiki->run()
#22 /srv/mediawiki/w/index.php(3): require(string)
#23 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 updated the task description. (Show Details)
Aklapper renamed this task from MWException when logging in on wikitech to MWException when logging in on wikitech: "CAS update failed on user_touched. The version of the user to be saved is older than the current version.".Apr 7 2020, 5:58 PM
Aklapper edited Stack Trace. (Show Details)
Aklapper set Phatality ID to 0f0610e4c8878e64714c29872f1e7283b8a669a880fe2b4330bd71aa5097fde8.
Krinkle renamed this task from MWException when logging in on wikitech: "CAS update failed on user_touched. The version of the user to be saved is older than the current version." to Logging in on Wikitech can throw fatal from LdapAuthentication "CAS update failed on user_touched".Apr 29 2020, 7:00 PM
Krinkle changed Request URL from https://wikitech.wikimedia.org/w/index.php?title=Special:UserLogin&returnto=Incident+documentation/20200407-Wikidata%27s+wb+items+per+site+table+dropped to https://wikitech.wikimedia.org/w/index.php?title=Special:UserLogin.
Krinkle subscribed.

Not sure if this is deterministic or just an ocasional fluke. To be determined :)

eprodromou subscribed.

Is this a regular occurrence? Do we have information about this in the logs?

It doesn't seem to be specific to Wikitech: I just saw this:

[ea835f4a-c45b-43c5-8263-d6bdf9860294] /wiki/%E0%AE%9A%E0%AE%BF%E0%AE%B1%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AF%81:ConfirmEmail/3c66ce0cffc17aea55adc49719aa464c   MWException from line 3430 of /srv/mediawiki/php-1.35.0-wmf.41/includes/user/User.php: CAS update failed on user_touched. The version of the user to be saved is older than the current version.

in logstash for tawiki.

#0 /srv/mediawiki/php-1.35.0-wmf.41/includes/libs/rdbms/database/Database.php(4405): User->{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#1 /srv/mediawiki/php-1.35.0-wmf.41/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure)
#2 /srv/mediawiki/php-1.35.0-wmf.41/includes/libs/rdbms/database/DBConnRef.php(641): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#3 /srv/mediawiki/php-1.35.0-wmf.41/includes/user/User.php(3441): Wikimedia\Rdbms\DBConnRef->doAtomicSection(string, Closure)
#4 /srv/mediawiki/php-1.35.0-wmf.41/includes/specials/SpecialConfirmEmail.php(170): User->saveSettings()
#5 /srv/mediawiki/php-1.35.0-wmf.41/includes/specials/SpecialConfirmEmail.php(78): SpecialConfirmEmail->attemptConfirm(string)
#6 /srv/mediawiki/php-1.35.0-wmf.41/includes/specialpage/SpecialPage.php(600): SpecialConfirmEmail->execute(string)
#7 /srv/mediawiki/php-1.35.0-wmf.41/includes/specialpage/SpecialPageFactory.php(635): SpecialPage->run(string)
#8 /srv/mediawiki/php-1.35.0-wmf.41/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#9 /srv/mediawiki/php-1.35.0-wmf.41/includes/MediaWiki.php(940): MediaWiki->performRequest()
#10 /srv/mediawiki/php-1.35.0-wmf.41/includes/MediaWiki.php(543): MediaWiki->main()
#11 /srv/mediawiki/php-1.35.0-wmf.41/index.php(53): MediaWiki->run()
#12 /srv/mediawiki/php-1.35.0-wmf.41/index.php(46): wfIndexMain()
#13 /srv/mediawiki/w/index.php(3): require(string)
#14 {main}

1,596 of these (or similar) in an hour.
/srv/mediawiki/php-1.36.0-wmf.3/includes/user/User.php:3429
CAS update failed on user_touched. The version of the user to be saved is older than the current version.

URL: /wiki/Special:ConfirmEmail

#0 /srv/mediawiki/php-1.36.0-wmf.3/includes/libs/rdbms/database/Database.php(4461): User->{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#1 /srv/mediawiki/php-1.36.0-wmf.3/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure)
#2 /srv/mediawiki/php-1.36.0-wmf.3/includes/libs/rdbms/database/DBConnRef.php(641): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#3 /srv/mediawiki/php-1.36.0-wmf.3/includes/user/User.php(3440): Wikimedia\Rdbms\DBConnRef->doAtomicSection(string, Closure)
#4 /srv/mediawiki/php-1.36.0-wmf.3/includes/user/User.php(3845): User->saveSettings()
#5 /srv/mediawiki/php-1.36.0-wmf.3/includes/specials/SpecialConfirmEmail.php(138): User->sendConfirmationMail()
#6 /srv/mediawiki/php-1.36.0-wmf.3/includes/htmlform/HTMLForm.php(707): SpecialConfirmEmail->submitSend(array, OOUIHTMLForm)
#7 /srv/mediawiki/php-1.36.0-wmf.3/includes/htmlform/HTMLForm.php(597): HTMLForm->trySubmit()
#8 /srv/mediawiki/php-1.36.0-wmf.3/includes/htmlform/HTMLForm.php(613): HTMLForm->tryAuthorizedSubmit()
#9 /srv/mediawiki/php-1.36.0-wmf.3/includes/specials/SpecialConfirmEmail.php(111): HTMLForm->show()
#10 /srv/mediawiki/php-1.36.0-wmf.3/includes/specials/SpecialConfirmEmail.php(72): SpecialConfirmEmail->showRequestForm()
#11 /srv/mediawiki/php-1.36.0-wmf.3/includes/specialpage/SpecialPage.php(600): SpecialConfirmEmail->execute(NULL)
#12 /srv/mediawiki/php-1.36.0-wmf.3/includes/specialpage/SpecialPageFactory.php(635): SpecialPage->run(NULL)
#13 /srv/mediawiki/php-1.36.0-wmf.3/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#14 /srv/mediawiki/php-1.36.0-wmf.3/includes/MediaWiki.php(940): MediaWiki->performRequest()
#15 /srv/mediawiki/php-1.36.0-wmf.3/includes/MediaWiki.php(543): MediaWiki->main()
#16 /srv/mediawiki/php-1.36.0-wmf.3/index.php(53): MediaWiki->run()
#17 /srv/mediawiki/php-1.36.0-wmf.3/index.php(46): wfIndexMain()
#18 /srv/mediawiki/w/index.php(3): require(string)
#19 {main}

@dancy Those are about ConfirmEmail updating the user object on regular production wikis. This task is about updates to the user object during user login that involve LdapAuthentication on wikitech.wikimedia.org. They are the same class of issue, but most likely not overlapping in their root cause.

Logstash mediawiki-errors query message:"CAS update failed" AND server:wikitech.wikimedia.org shows, however, that the original issue observed here is also still unresolved. A sample from May 21:

MWException: CAS update failed on user_touched. The version of the user to be saved is older than the current version.
from /srv/mediawiki/php-1.37.0-wmf.6/includes/user/User.php(3287)
#0 /srv/mediawiki/php-1.37.0-wmf.6/includes/libs/rdbms/database/Database.php(4654): User->{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#1 /srv/mediawiki/php-1.37.0-wmf.6/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure)
#2 /srv/mediawiki/php-1.37.0-wmf.6/includes/libs/rdbms/database/DBConnRef.php(649): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#3 /srv/mediawiki/php-1.37.0-wmf.6/includes/user/User.php(3299): Wikimedia\Rdbms\DBConnRef->doAtomicSection(string, Closure)
#4 /srv/mediawiki/php-1.37.0-wmf.6/extensions/LdapAuthentication/includes/LdapAuthenticationPlugin.php(1261): User->saveSettings()
#5 /srv/mediawiki/php-1.37.0-wmf.6/extensions/LdapAuthentication/includes/LdapPrimaryAuthenticationProvider.php(133): LdapAuthenticationPlugin->updateUser(User)
#6 /srv/mediawiki/php-1.37.0-wmf.6/includes/HookContainer/HookContainer.php(330): LdapPrimaryAuthenticationProvider->onUserLoggedIn(User)
#7 /srv/mediawiki/php-1.37.0-wmf.6/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#8 /srv/mediawiki/php-1.37.0-wmf.6/includes/HookContainer/HookRunner.php(4256): MediaWiki\HookContainer\HookContainer->run(string, array)
#9 /srv/mediawiki/php-1.37.0-wmf.6/includes/auth/AuthManager.php(2443): MediaWiki\HookContainer\HookRunner->onUserLoggedIn(User)
#10 /srv/mediawiki/php-1.37.0-wmf.6/includes/auth/AuthManager.php(749): MediaWiki\Auth\AuthManager->setSessionDataForUser(User, boolean)
#11 /srv/mediawiki/php-1.37.0-wmf.6/includes/auth/AuthManager.php(428): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#12 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/AuthManagerSpecialPage.php(372): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#13 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/AuthManagerSpecialPage.php(502): AuthManagerSpecialPage->performAuthenticationStep(string, array)
#14 /srv/mediawiki/php-1.37.0-wmf.6/includes/htmlform/HTMLForm.php(717): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)
#15 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/AuthManagerSpecialPage.php(435): HTMLForm->trySubmit()
#16 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/LoginSignupSpecialPage.php(318): AuthManagerSpecialPage->trySubmit()
#17 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/SpecialPage.php(646): LoginSignupSpecialPage->execute(NULL)
#18 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/SpecialPageFactory.php(1390): SpecialPage->run(NULL)
#19 /srv/mediawiki/php-1.37.0-wmf.6/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#20 /srv/mediawiki/php-1.37.0-wmf.6/includes/MediaWiki.php(917): MediaWiki->performRequest()
#21 /srv/mediawiki/php-1.37.0-wmf.6/includes/MediaWiki.php(551): MediaWiki->main()
#22 /srv/mediawiki/php-1.37.0-wmf.6/index.php(53): MediaWiki->run()
#23 /srv/mediawiki/php-1.37.0-wmf.6/index.php(46): wfIndexMain()
#24 /srv/mediawiki/w/index.php(3): require(string)
#25 {main}