Can not login to gerrit!

494 views
Skip to first unread message

vista...@gmail.com

unread,
Jun 21, 2018, 9:47:50 PM6/21/18
to Repo and Gerrit Discussion
Hi,all:
     
       auth.type = http  and a new account  which was create by restapi 'PUT /accounts/{username}'

       when login to gerrit,I got the error "com.google.gerrit.server.account.AccountUserNameException: Cannot assign user name "xxx" to account 101; name already in use." 

       when refresh the login web,new error occur."com.google.gerrit.server.account.AccountUserNameException: Cannot assign user name "xxx" to account 102; name already in use."


Why?


Thanks!

Sven Selberg

unread,
Jun 25, 2018, 3:56:16 AM6/25/18
to Repo and Gerrit Discussion
Which version of Gerrit?
Could it be this bug fixed in 2.14.7?

/Sven

vista...@gmail.com

unread,
Jun 26, 2018, 9:56:22 PM6/26/18
to Repo and Gerrit Discussion
2.13.7

David Hayes

unread,
Jun 27, 2018, 10:57:01 AM6/27/18
to Repo and Gerrit Discussion
Saw this issue in the past when swapping from LDAP auth to another type. The account was duplicated in the DB and had to be manually corrected.

vista...@gmail.com

unread,
Jun 28, 2018, 4:25:17 AM6/28/18
to Repo and Gerrit Discussion
Hi,David:

    The miss entry in  DB had to be manually corrected is too much trouble.

    And the content like change [1] should be merged to 2.13.x

Thanks!


vista...@gmail.com

unread,
Jun 29, 2018, 3:27:33 AM6/29/18
to Repo and Gerrit Discussion
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountManager.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountManager.java
@@ -127,6 +127,15 @@ public class AccountManager {
         AccountExternalId.Key key = id(who);
         AccountExternalId id = getAccountExternalId(db, key);
         if (id == null) {
+          if (who.getUserName() != null) {
+            Account.Id ext = lookup("username:" + who.getUserName());
+            if (ext != null){
+              // An inconsistency is detected in the database, having a record for scheme "username:"
+              // but no record for scheme "gerrit:". Try to recover by linking
+              // "gerrit:" identity to the existing account.
+              return link(ext, who);
+            }
+          }
           // New account, automatically create and return.
           //
           return create(db, who);
@@ -159,10 +168,10 @@ public class AccountManager {
           }
         }
       }
-      return null;
     }

     // We don't have at the moment an account_by_external_id cache
+    // or for whatever reason the account external id was not indexed
     // but by using the accounts cache we get the list of external_ids
     // without having to query the DB every time
     if (key.getScheme().equals(AccountExternalId.SCHEME_GERRIT)

Edwin Kempin

unread,
Jun 29, 2018, 3:43:45 AM6/29/18
to vista...@gmail.com, Repo and Gerrit Discussion
Sorry, but we don't accept patches through the mailing list.
Please push any contribution/patch to the Gerrit project (https://gerrit-review.googlesource.com/admin/repos/gerrit).

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

thomasmu...@yahoo.com

unread,
Jun 29, 2018, 9:03:06 AM6/29/18
to Repo and Gerrit Discussion
At the wmf we had this problem, @luca created this patch (was on the master branch but it was near sync with the 2.13 branch)



On Friday, June 22, 2018 at 2:47:50 AM UTC+1, vista...@gmail.com wrote:

thomasmu...@yahoo.com

unread,
Jun 29, 2018, 9:03:28 AM6/29/18
to Repo and Gerrit Discussion
We doin't use that change anymore, now that we are on 2.15.


On Friday, June 22, 2018 at 2:47:50 AM UTC+1, vista...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages