Last modified: 2013-06-27 10:19:36 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 41609 - Exception: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
Exception: User::addToDatabase: hit a key conflict attempting to insert a use...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
CentralAuth (Other open bugs)
master
All All
: High normal (vote)
: ---
Assigned To: Aaron Schulz
:
: 41659 (view as bug list)
Depends on:
Blocks: code_quality
  Show dependency treegraph
 
Reported: 2012-10-31 23:38 UTC by Krinkle
Modified: 2013-06-27 10:19 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2012-10-31 23:38:50 UTC
Comes up pretty often in the logs, even on action=raw, CentralNotice and api.php requests.

A few samples:

2012-10-31 22:03:32 mw43 metawiki: [752b3943] /w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400

Exception from line 3079 of /usr/local/apache/common-local/php-1.21wmf3/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'W1k1n66m')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)


--
2012-10-31 22:05:29 mw52 metawiki: [3b339d91] /wiki/Special:BannerRandom?userlang=es&sitename=Wikimedia+Commons&project=commons&anonymous=false&bucket=0&country=ES&slot=10

Exception from line 3079 of /usr/local/apache/common-local/php-1.21wmf3/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'Cotillasnosotro...')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)


--
2012-10-31 22:10:43 srv203 metawiki: [453483ac] /w/index.php?title=MediaWiki:OSM.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400

Exception from line 3079 of /usr/local/apache/common-local/php-1.21wmf3/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'Aldha')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)


--
2012-10-31 22:18:02 srv301 huwiki: [7731f9cf] /w/api.php?action=query&titles...p=size&format=json

Exception from line 3072 of /usr/local/apache/common-local/php-1.21wmf2/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf2/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf2/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'Blake13441')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf2/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)


--
2012-10-31 22:24:47 mw21 metawiki: [63064713] /w/index.php?title=MediaWiki:OSM.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400

Exception from line 3079 of /usr/local/apache/common-local/php-1.21wmf3/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'JorgebossGL')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)


--
2012-10-31 22:31:46 srv241 commonswiki: [36936ded] /wiki/Category:Solar_eclipse

Exception from line 3079 of /usr/local/apache/common-local/php-1.21wmf3/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'Mvemjsunp8')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)


--
2012-10-31 22:36:28 mw39 metawiki: [32ca71d8] /wiki/Special:BannerRandom?userlang=da&sitename=Wikipedia&project=wikipedia&anonymous=false&bucket=0&country=DK&slot=30

Exception from line 3079 of /usr/local/apache/common-local/php-1.21wmf3/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(568): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.21wmf3/extensions/CentralAuth/CentralAuthHooks.php(276): CentralAuthHooks::attemptAddUser(Object(User), 'Djbenne')
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('CentralAuthHook...', Array)
Comment 1 Matt Walker 2012-11-02 01:01:12 UTC
*** Bug 41659 has been marked as a duplicate of this bug. ***
Comment 2 Rob Lanphier 2012-12-12 20:54:20 UTC
Chris, could you take a look at this one?
Comment 3 Chris Steipp 2012-12-13 03:10:20 UTC
I'm going to guess the race condition that Tim's patch (I1f6ef5e6319bfe692fb82a3fa50dc66c9fde8f15) addresses is still happening, and in some cases it's causing this weird situation to occur.

It would be nice to know the value of $this->mId when the exception happens. Anyone mind if we add that to the exception message?
Comment 4 Aaron Schulz 2013-06-19 21:12:23 UTC
This is far less frequent after the CentralAuth fix by Marius to check if names are valid before doing the INSERT (the IGNORE caused silent truncation, so the insert affected a row but the SELECT later failed).

This still sometimes occurs due to INSERT INGORE semantics mixing very awkwardly with REPEATABLE READ isolation.
Comment 5 Aaron Schulz 2013-06-19 21:14:34 UTC
Typical error:

2013-06-19 15:42:38 mw1018 metawiki: [935537c9] /wiki/Help:Unified_login/ru   Exception from line 3303 of /usr/local/apache/common-local/php-1.22wmf7/includes/User.php: User::addToDatabase: hit a key conflict attempting to insert user 'Ni-kasyanov' row, but it was not present in select!
#0 /usr/local/apache/common-local/php-1.22wmf7/extensions/CentralAuth/CentralAuthHooks.php(824): User->addToDatabase()
#1 /usr/local/apache/common-local/php-1.22wmf7/extensions/CentralAuth/CentralAuthHooks.php(524): CentralAuthHooks::attemptAddUser(Object(User))
#2 [internal function]: CentralAuthHooks::onUserLoadFromSession(Object(User), NULL)
#3 /usr/local/apache/common-local/php-1.22wmf7/includes/Hooks.php(196): call_user_func_array('CentralAuthHook...', Array)
#4 /usr/local/apache/common-local/php-1.22wmf7/includes/GlobalFunctions.php(3834): Hooks::run('UserLoadFromSes...', Array)
#5 /usr/local/apache/common-local/php-1.22wmf7/includes/User.php(929): wfRunHooks('UserLoadFromSes...', Array)
#6 /usr/local/apache/common-local/php-1.22wmf7/includes/User.php(291): User->loadFromSession()
#7 /usr/local/apache/common-local/php-1.22wmf7/includes/User.php(4400): User->load()
#8 /usr/local/apache/common-local/php-1.22wmf7/includes/User.php(2278): User->loadOptions()
#9 /usr/local/apache/common-local/php-1.22wmf7/includes/context/RequestContext.php(296): User->getOption('language')
#10 /usr/local/apache/common-local/php-1.22wmf7/includes/Message.php(360): RequestContext->getLanguage()
#11 /usr/local/apache/common-local/php-1.22wmf7/includes/context/RequestContext.php(377): Message->setContext(Object(RequestContext))
#12 [internal function]: RequestContext->msg('pagetitle')
#13 /usr/local/apache/common-local/php-1.22wmf7/includes/context/ContextSource.php(165): call_user_func_array(Array, Array)
#14 /usr/local/apache/common-local/php-1.22wmf7/includes/OutputPage.php(889): ContextSource->msg('pagetitle')
#15 /usr/local/apache/common-local/php-1.22wmf7/includes/Article.php(555): OutputPage->setPageTitle('Help:Unified lo...')
#16 /usr/local/apache/common-local/php-1.22wmf7/includes/actions/ViewAction.php(44): Article->view()
#17 /usr/local/apache/common-local/php-1.22wmf7/includes/Wiki.php(439): ViewAction->show()
#18 /usr/local/apache/common-local/php-1.22wmf7/includes/Wiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#19 /usr/local/apache/common-local/php-1.22wmf7/includes/Wiki.php(565): MediaWiki->performRequest()
#20 /usr/local/apache/common-local/php-1.22wmf7/includes/Wiki.php(458): MediaWiki->main()
#21 /usr/local/apache/common-local/php-1.22wmf7/index.php(55): MediaWiki->run()
#22 /usr/local/apache/common-local/w/index.php(3): require('/usr/local/apac...')
#23 {main}
Comment 6 Aaron Schulz 2013-06-26 22:58:29 UTC
Should be rare with https://gerrit.wikimedia.org/r/#/c/69587/
Comment 7 JavierDelPozo 2013-06-27 10:19:36 UTC
Thank you very much, Aaron.

I have tried that patch (https://gerrit.wikimedia.org/r/#/c/69587/), and I am still getting these messages:

User::addToDatabase: hit a key conflict attempting to insert a user row, but then it doesn't exist when we select it!
Backtrace:
#0 /home/mediawiki_SBM/includes/specials/SpecialUserlogin.php(468): User->addToDatabase()
#1 /home/mediawiki_SBM/includes/specials/SpecialUserlogin.php(453): LoginForm->initUser(Object(User), false)
#2 /home/mediawiki_SBM/includes/specials/SpecialUserlogin.php(236): LoginForm->addNewAccountInternal()
#3 /home/mediawiki_SBM/includes/specials/SpecialUserlogin.php(178): LoginForm->addNewAccount()
#4 /home/mediawiki_SBM/includes/SpecialPage.php(613): LoginForm->execute(NULL)
#5 /home/mediawiki_SBM/includes/SpecialPageFactory.php(487): SpecialPage->run(NULL)
#6 /home/mediawiki_SBM/includes/Wiki.php(291): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#7 /home/mediawiki_SBM/includes/Wiki.php(565): MediaWiki->performRequest()
#8 /home/mediawiki_SBM/includes/Wiki.php(458): MediaWiki->main()
#9 /home/mediawiki_SBM/index.php(59): MediaWiki->run()
#10 {main}

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links