A user who hasn't logged in to our Gerrit 2.10 instance for a few months tried to log in yesterday and got a "Forbidden" error. In the logs I see this:
[2022-05-05 11:09:47,829] ERROR com.google.gerrit.server.account.AccountManager : Cannot assign user name "redacted" to account 1000064; name already in use.
[2022-05-05 11:09:47,836] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user "redacted"
com.google.gerrit.server.account.AccountUserNameException: Cannot assign user name "redacted" to account 1000064; name already in use.
It appears that he tried to re-register (more than once, in fact), which created a new user ID that no longer matches his user name. As a Gerrit admin, is there some way that I can view the user IDs and remove the ones that are bogus?
I just tried running this command, but it failed:
user@desktop=> ssh -p 29418 ad...@gerrit.whoi.edu gerrit set-account --delete-external-id 1000060 redacted
fatal: "--delete-external-id" is not a valid option
Is there some way for me to 1) determine how many external-ids are associated with the account, and 2) remove the ones that are redundant?
Short of that, would it be possible to just delete the account entirely and start out from scratch?
Paul
Paul Mena
Senior Application Administrator
WHOI - Information Services
A user who hasn't logged in to our Gerrit 2.10 instance for a few months tried to log in yesterday and got a "Forbidden" error. In the logs I see this:
[2022-05-05 11:09:47,829] ERROR com.google.gerrit.server.account.AccountManager : Cannot assign user name "redacted" to account 1000064; name already in use. [2022-05-05 11:09:47,836] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user "redacted" com.google.gerrit.server.account.AccountUserNameException: Cannot assign user name "redacted" to account 1000064; name already in use.
It appears that he tried to re-register, which created a new user ID that no longer matches his user name. He tried to do that several times, each time creating a new ID. As a Gerrit admin, is there some way that I can view the user IDs and remove the ones that are bogus?
A user who hasn't logged in to our Gerrit 2.10 instance for a few months tried to log in yesterday and got a "Forbidden" error. In the logs I see this:
[2022-05-05 11:09:47,829] ERROR com.google.gerrit.server.account.AccountManager : Cannot assign user name "redacted" to account 1000064; name already in use.
[2022-05-05 11:09:47,836] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user "redacted"
com.google.gerrit.server.account.AccountUserNameException: Cannot assign user name "redacted" to account 1000064; name already in use.
It appears that he tried to re-register (more than once, in fact), which created a new user ID that no longer matches his user name. As a Gerrit admin, is there some way that I can view the user IDs and remove the ones that are bogus?
I just tried running this command, but it failed:
user@desktop=> ssh -p 29418 ad...@gerrit.whoi.edu gerrit set-account --delete-external-id 1000060 redactedfatal: "--delete-external-id" is not a valid option
Is there some way for me to 1) determine how many external-ids are associated with the account, and 2) remove the ones that are redundant?
Short of that, would it be possible to just delete the account entirely and start out from scratch?
--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/MW5PR16MB45947F6951160BB945234AA0CEC59%40MW5PR16MB4594.namprd16.prod.outlook.com.
Mattias,
Thank you for the reply! We would love to upgrade our Gerrit 2.10 instance to something newer and are trying to get that into our next budget.
In the meantime, I’ve been able to query the Gerrit database (after taking a backup) and have noticed 1) there are no account_ids beyond 1000059, making it more baffling that the error below references the account_id 1000065, 2) the troubled account is lacking a row in the database.
To illustrate, here is a query from a working account (mine):
gerrit> select * from account_external_ids where external_id like '%pmena%';
account_id | email_address | password | external_id
-----------+---------------------+----------+----------------------
1000058 | 'pm...@default.com' | NULL | gerrit:pmena
1000058 | NULL | NULL | username:pmena
1000058 | pm...@whoi.edu | NULL | mailto:pm...@whoi.edu
(3 rows; 1 ms)
Next, a query of the affected account:
gerrit> select * from account_external_ids where external_id like '%redacted%';
account_id | email_address | password | external_id
-----------+-------------------+----------+-------------------------
1000059 | NULL | NULL | username:redacted
1000059 | reda...@whoi.edu | NULL | mailto:reda...@whoi.edu
(2 rows; 1 ms)
As you can see, the row that should contain the external_id “gerrit:redacted” is missing. Is there a way to remedy this?
Thank you so much for the help!
Paul
Paul Mena
Senior Application Administrator
Woods Hole Oceanographic Institution
Mattias,
Thank you for the reply! We would love to upgrade our Gerrit 2.10 instance to something newer and are trying to get that into our next budget.
In the meantime, I’ve been able to query the Gerrit database (after taking a backup) and have noticed 1) there are no account_ids beyond 1000059, making it more baffling that the error below references the account_id 1000065, 2) the troubled account is lacking a row in the database.
To illustrate, here is a query from a working account (mine):
gerrit> select * from account_external_ids where external_id like '%pmena%';
account_id | email_address | password | external_id
-----------+---------------------+----------+----------------------
1000058 | 'pm...@default.com' | NULL | gerrit:pmena
1000058 | NULL | NULL | username:pmena
1000058 | pm...@whoi.edu | NULL | mailto:pm...@whoi.edu
(3 rows; 1 ms)
Next, a query of the affected account:
gerrit> select * from account_external_ids where external_id like '%redacted%';
account_id | email_address | password | external_id
-----------+-------------------+----------+-------------------------
1000059 | NULL | NULL | username:redacted
1000059 | reda...@whoi.edu | NULL | mailto:reda...@whoi.edu
(2 rows; 1 ms)
As you can see, the row that should contain the external_id “gerrit:redacted” is missing. Is there a way to remedy this?
Hello Paul,
Our instance at Wikimedia often had the issue or very similar and we have multiple tasks matching that error logging in our Bug tracker ( https://phabricator.wikimedia.org/search/query/sehZkGQkCCmF/#R ).One of the oldest task has a detailed problem statement https://phabricator.wikimedia.org/T49385#489415
, albeit it lacks a described solution it exposes two potential
causes:
The task hints at manually inserting a missing row in account_external_ids.
Eventually that got solved by moving everything to be lower cased (the database connections, all gerrit: entries and the LDAP connection made all lower case) which was https://phabricator.wikimedia.org/T152640 .
The id 1000065 is an auto increment in the database, I think the database assign the id, keep track of the last assigned value then attempts to do the insert in a transaction which ends up rejected by the increment counter is kept. Something like that and on the task at https://phabricator.wikimedia.org/T152640#2856932 the user "addshore" with id 106 when logging it with mixed case like AddShore or Addshore ended up being rejected and generating on the backend:
Cannot assign user name "addshore" to account 4238; name already in use.
Cannot assign user name "addshore" to account 4239; name already in use.
Which sounds very similar. Then we were running Gerrit 2.12 at the time so it might be an entirely different problem.
Maybe that account 1000059 got half created due to another
existing account having the same email address? Or it is half
created because another account has the same username albeit with
a different case (like Pmena versus pmena). It might well be the
issue, we had been crippled by the mixed case until we normalized
everything to lower case (db, ldap, gerrit).
Maybe you need to insert (BUT PLEASE MAKE A BACKUP FIRST):
account_id | email_address | password | external_id
-----------+-------------------+----------+-------------------------
1000059 | reda...@whoi.edu | NULL | gerrit:redacted
A long time ago we also had issue with usernames containing unicode https://phabricator.wikimedia.org/T37626 and went to use:
[database]
type = mysql
url = jdbc:mysql://<db host>/<db
name>/?characterSetResults=utf8&characterEncoding=utf8&connectionCollation=utf8_unicode_ci
Which can well break a lot more things and would vary depending
on your database support for unicode (old MySQL did not have
support for the full unicode space).
-- Antoine "hashar" Musso Release Engineering
Antoine,
Thank you for the response! I tested out an insert command on a copy of the account_external_ids table and it did what I expected it to do.
gerrit> create table test_account_external_ids as table account_external_ids;
UPDATE 0; 166 ms
gerrit> insert into test_account_external_ids(account_id, email_address, external_id) values (1000059, 'reda...@default.com', 'gerrit:redacted);
UPDATE 1; 3 ms
gerrit> select * from test_account_external_ids where external_id like '%redacted%';
account_id | email_address | password | external_id
-----------+----------------------+----------+-------------------------
1000059 | NULL | NULL | username:redacted
1000059 | reda...@whoi.edu | NULL | mailto:reda...@whoi.edu
1000059 | reda...@default.com | NULL | gerrit:redacted
(3 rows; 1 ms)
I applied this change to the real table and the user was able to log in to Gerrit without errors. Thank you again!
Paul Mena
Senior Application Administrator
WHOI - Information Services
From: Antoine Musso <amu...@wikimedia.org>
Sent: Monday, May 9, 2022 3:44 PM
To: Paul Mena <pm...@whoi.edu>
Cc: repo-d...@googlegroups.com
Subject: Re: unable to log in to Gerrit - "name already in use"
Le 09/05/2022 à 15:49, Paul Mena a écrit :
Antoine,
Thank you for the response! I tested out an insert command on a copy of the account_external_ids table and it did what I expected it to do.
gerrit> create table test_account_external_ids as table account_external_ids;
UPDATE 0; 166 ms
gerrit> insert into test_account_external_ids(account_id, email_address, external_id) values (1000059, 'reda...@default.com', 'gerrit:redacted);
UPDATE 1; 3 ms
gerrit> select * from test_account_external_ids where external_id like '%redacted%';
account_id | email_address | password | external_id
-----------+----------------------+----------+-------------------------
1000059 | NULL | NULL | username:redacted
1000059 | reda...@whoi.edu | NULL | mailto:reda...@whoi.edu
1000059 | reda...@default.com | NULL | gerrit:redacted
(3 rows; 1 ms)
I applied this change to the real table and the user was able to log in to Gerrit without errors. Thank you again!
Hello Paul,
I am very happy to see you have managed to fix that login issue!