Last modified: 2013-04-19 01:04:16 UTC
Created attachment 12140 [details] Screenshot of the Gerrit error message It's impossible for me to log in into Gerrit right now; I'm getting a not particularly helpful "Cannot assign user name error" message (see attachment). LeslieCarr on IRC tells me she was getting fine logins coming from my IP address, but I am still logged out (tested this on two browsers).
Have you been able to log in previously, or was this the first time? I'm not seeing any errors in the log, but your account_external_id entries seem to be weird (missing the gerrit: one to link with LDAP). Can probably fix this by hand in the database, but I'm curious why this happened.
Possibly I am barking up the wrong tree, as I can reproduce the problem only locally and not on the wmf gerrit. And although I am lacking admin access to our gerrit installation, it might be that the account_external_ids table in MySQL does not match what is entered by the user in the 'Username' field in gerrit's login screen. For the user otter, there should by two rows in the account_external_ids table: +------------+----------------------------+----------+-------------------------------------------+ | account_id | email_address | password | external_id | +------------+----------------------------+----------+-------------------------------------------+ | 4711 | otters email address | NULL | gerrit:otter | | 4711 | NULL | NULL | username:otter | +------------+----------------------------+----------+-------------------------------------------+ Which acount_id is used does not matter, but the two rows should come with the same account_id. Also the casing of otter in 'gerrit:otter' and 'username:otter' may differ. I could reproduce the 'Cannot assign user name' error message locally if either * the first line (i.e.: the line with 'gerrit:...' in external_id column) is missing (I cannot reliable reproduce a way to make that line missing), or * the casing of the part after 'gerrit:' does not match what is entered for the 'Username' field in gerrit's login screen. So for the above 'gerrit:...' row, 'otter' would work, while 'Otter' or 'oTTer' would give the 'Cannot assign user name' error message. To solve the issue, someone with SQL access (Chad?) could have a look at the otter's 'gerrit:...' row in the account_external_ids table, and * if the row does not exist, create it, or * if the row exists, tell otter about the correct casing of the part after 'gerrit:' (It's the one used when logging in for the first time) If it turns out that this did not help, for me the relevant part in gerrit was ./gerrit-server/src/main/java/com/google/gerrit/server/account/AccountManager.java:63 That line fetches the external_id (gerrit:... line). If that cannot be found, it is assumed the user does not exist yet, and it is tried to add it to the database. So another 'username:...' row is added, which throws the OrmException that leads to the 'Cannot assign user name' error message. The exception the above problem throws for me locally is: [2013-04-19 00:44:27,011] ERROR com.google.gerrit.server.account.AccountManager : Cannot assign user name com.google.gwtorm.server.OrmException: insert failure on account_external_ids at com.google.gwtorm.schema.sql.SqlDialect.convertError(SqlDialect.java:151) at com.google.gwtorm.jdbc.JdbcAccess.convertError(JdbcAccess.java:448) at com.google.gwtorm.jdbc.JdbcAccess.insert(JdbcAccess.java:160) at com.google.gerrit.server.account.ChangeUserName.call(ChangeUserName.java:115) at com.google.gerrit.server.account.AccountManager.create(AccountManager.java:308) at com.google.gerrit.server.account.AccountManager.authenticate(AccountManager.java:115) at com.google.gerrit.httpd.auth.ldap.LdapLoginServlet.doPost(LdapLoginServlet.java:175) [...]
Oh ... Chad was quicker :-)
(In reply to comment #1) > Have you been able to log in previously, or was this the first time? Yes, I have been able to log in to Gerrit for the previous month or so (ever since I started submitting patches). I tried logging in both with the lowercase ('odder') and the uppercase version ('Odder'), with the same results (ie. none).
(In reply to comment #2) > Possibly I am barking up the wrong tree, as I can reproduce the > problem only locally and not on the wmf gerrit. > > And although I am lacking admin access to our gerrit installation, it > might be that the account_external_ids table in MySQL does not match > what is entered by the user in the 'Username' field in gerrit's login > screen. > > For the user otter, there should by two rows in the > account_external_ids table: > > > +------------+----------------------------+----------+----------------------- > --------------------+ > | account_id | email_address | password | external_id > > | > > +------------+----------------------------+----------+----------------------- > --------------------+ > | 4711 | otters email address | NULL | gerrit:otter > > | > | 4711 | NULL | NULL | username:otter > > | > > +------------+----------------------------+----------+----------------------- > --------------------+ > > Which acount_id is used does not matter, but the two rows should come > with the same account_id. > This is all true. > Also the casing of otter in 'gerrit:otter' and 'username:otter' may > differ. > > I could reproduce the 'Cannot assign user name' error message locally > if either > * the first line (i.e.: the line with 'gerrit:...' in external_id > column) is missing (I cannot reliable reproduce a way to make that > line missing), or > * the casing of the part after 'gerrit:' does not match what is > entered for the 'Username' field in gerrit's login screen. > So for the above 'gerrit:...' row, 'otter' would work, while 'Otter' > or 'oTTer' would give the 'Cannot assign user name' error message. > The first of the two cases is what's going on here, Otter is missing his gerrit: row. Not a clue why. > To solve the issue, someone with SQL access (Chad?) could have a look > at the otter's 'gerrit:...' row in the account_external_ids table, and > * if the row does not exist, create it, or > * if the row exists, tell otter about the correct casing of the > part after 'gerrit:' (It's the one used when logging in for the > first time) > Yeah, I can fix it manually, which I'll do now. (Pause) And done. > > If it turns out that this did not help, for me the relevant part in > gerrit was > > ./gerrit-server/src/main/java/com/google/gerrit/server/account/ > AccountManager.java:63 > That line fetches the external_id (gerrit:... line). If that cannot be > found, it is assumed the user does not exist yet, and it is tried to > add it to the database. So another 'username:...' row is added, which > throws the OrmException that leads to the 'Cannot assign user name' > error message. The exception the above problem throws for me locally is: > > [2013-04-19 00:44:27,011] ERROR > com.google.gerrit.server.account.AccountManager > : Cannot assign user name > com.google.gwtorm.server.OrmException: insert failure on account_external_ids > at > com.google.gwtorm.schema.sql.SqlDialect.convertError(SqlDialect.java:151) > at com.google.gwtorm.jdbc.JdbcAccess.convertError(JdbcAccess.java:448) > at com.google.gwtorm.jdbc.JdbcAccess.insert(JdbcAccess.java:160) > at > com.google.gerrit.server.account.ChangeUserName.call(ChangeUserName.java:115) > at > com.google.gerrit.server.account.AccountManager.create(AccountManager.java: > 308) > at > com.google.gerrit.server.account.AccountManager.authenticate(AccountManager. > java:115) > at > com.google.gerrit.httpd.auth.ldap.LdapLoginServlet.doPost(LdapLoginServlet. > java:175) > [...] Not seeing this in the error log :\
Whee!