Last modified: 2013-04-19 01:04:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T49385, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47385 - Can't log in into Gerrit — "Cannot assign user name"
Can't log in into Gerrit — "Cannot assign user name"
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Git/Gerrit (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-18 21:28 UTC by Tomasz W. Kozlowski
Modified: 2013-04-19 01:04 UTC (History)
6 users (show)

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


Attachments
Screenshot of the Gerrit error message (36.84 KB, image/png)
2013-04-18 21:28 UTC, Tomasz W. Kozlowski
Details

Description Tomasz W. Kozlowski 2013-04-18 21:28:01 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).
Comment 1 Chad H. 2013-04-18 23:31:33 UTC
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.
Comment 2 christian 2013-04-19 00:01:06 UTC
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)
[...]
Comment 3 christian 2013-04-19 00:03:10 UTC
Oh ... Chad was quicker :-)
Comment 4 Tomasz W. Kozlowski 2013-04-19 00:28:34 UTC
(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).
Comment 5 Chad H. 2013-04-19 00:34:29 UTC
(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 :\
Comment 6 Tomasz W. Kozlowski 2013-04-19 01:04:16 UTC
Whee!

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


Navigation
Links