Page MenuHomePhabricator

SUL concurrent user creation
Closed, ResolvedPublic

Description

Author: koneko

Description:
There seems to be a missing "concurrent" test/protection during automatic account creation (with SUL) when one connects on a new wikimedia wiki.

If one open not one but 2 pages (in a tiny interval, like one second or less) on that wiki,
-the first one will cause the account to be created (normal behaviour)
-the 2nd one will show an error of the like of :

the following error occurs :

richiamata dalla funzione "User::addToDatabase". MySQL ha restituito il seguente errore "1062: Duplicate entry 'Darkoneko' for key 2 (10.0.6.21)".

I assume it's because the 2nd page doesn't detect that the 1st is already running the "account creation" thing.


The error message above was copied from napwiki (case happened some minutes ago) ; I also had the same case on another wikimedia wiki (forgot which) yesterday


Version: unspecified
Severity: minor

Details

Reference
bz18982

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:42 PM
bzimport set Reference to bz18982.
bzimport added a subscriber: Unknown Object (MLST).

happy.melon.wiki wrote:

I expect this is because the relevant functions check a slave DB to see if the user already exists, but creating the new user account if it doesn't involves writing to the DB master. So instance one checks a slave, sees no account, and writes a new user into the master 'user' table. Instance two checks a slave, which hasn't yet synced with the master and so *still* shows no account, tries to write the *same* new user into the master 'user' table, and MySQL quite rightly stops that happening. Presumably you could get the same result with just about any read/write-if-not-found action. Probably no way to avoid this except by doing the initial read on the DB master as well, which rather defeats the object of having a replicated database in the first place :D

  • This bug has been marked as a duplicate of bug 16020 ***