Errors in creating users

Hello.

I’m having trouble to solving a problem in my instance. It is at version 12.3.0, just with the frappe framework and a custom application.

Since last week I can’t correctly create a user. I was asked to register 10 new users. The first two were successfully created, but the others have the following problem:

I’m logged in as Administrator.
When I try to create a new user via frontend, when filling in the data and clicking on Save, the site is inactive for 60 seconds. And when finish this time, I get error 504:


Frappe_Figure_2

Even with this problem (which didn’t happen before) if I go back to the user list and refresh, the new user is there.

When I enter into this User profile, I already find something strange:
Frappe_Figure_3

After that, I need to add a specific role for this type of user. When selecting the role I want and clicking Save, again the screen freezes for 60 seconds and in the sequence the same error appears in the browser console (Firefox).

It reruns savedocs, and gets the same error on the console and http error 504.

I’ve tested it on both Chrome and Firefox.
Going back to the user list, the user is created. I can view his information, but I can’t make any changes. When I click on the save button, I get error 504 and nothing is saved.
Unfortunately I can’t see any evidence or stacktrace in the log. Observe both frappe.log, web.error.log, web.log, as they were the files that were updated on the day of the test. I also didn’t find anything in the Nginx logs.

An interesting point is that old users work correctly, I can change and save them without any slowness.

I even checked something different registered in the users table in the DB, but I didn’t find any significant differences. I then set out to add the user in another way, in an attempt to find better evidence to help me solve this problem.

I created in postman a POST call to https://???.com/api/resource/User, authenticating myself in the header and with the following body:

{
“name”: “teste10@teste.com”,
“owner”: “Administrator”,
“modified_by”: “alexandre@abcd.com.br”,
“idx”: 0,
“docstatus”: 0,
“enabled”: 1,
“email”: “teste10@teste.com”,
“first_name”: “Teste”,
“last_name”: “Dez”,
“full_name”: “Teste Dez”,
“send_welcome_email”: 0,
“unsubscribed”: 0,
“username”: “teste10”,
“mute_sounds”: 0,
“new_password”: "9Teste!abc”,
“logout_all_sessions”: 0,
“document_follow_notify”: 0,
“thread_notify”: 0,
“send_me_a_copy”: 0,
“allowed_in_mentions”: 0,
“simultaneous_sessions”: 0,
“user_type”: “System User”,
“login_after”: 0,
“login_before”: 0,
“bypass_restrict_ip_check_if_2fa_enabled”: 0,
“doctype”: “User”,
“roles”: [
{
“name”: “e4989717e2”,
“owner”: "thomaz.melo@abcd.com.br,
“creation”: “2020-06-03 10:15:48.093006”,
“modified”: “2021-09-16 13:44:16.219942”,
“modified_by”: “thomaz.melo@abcd.com.br”,
“parent”: “marcos@abcd.com.br”,
“parentfield”: “roles”,
“parenttype”: “User”,
“idx”: 1,
“docstatus”: 0,
“role”: “UOL”,
“doctype”: “Has Role”
}
],
“user_emails”: ,
“block_modules”: ,
“defaults”: ,
“social_logins”:
}

Again I get a 504 Gateway Time-out response. But when I go to the frontend, the user is created.

Then I try to use this user, and I get the Invalid Login error. In this case I can see an error in the web.log

Traceback (most recent call last):
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 252, in check_password
    return check_password(user, pwd)
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/utils/password.py", line 66, in check_password
    raise frappe.AuthenticationError(_('Incorrect User or Password'))
frappe.exceptions.AuthenticationError: Incorrect User or Password

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/app.py", line 52, in application
    init_request(request)
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/app.py", line 117, in init_request
    frappe.local.http_request = frappe.auth.HTTPRequest()
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 51, in __init__
    frappe.local.login_manager = LoginManager()
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 105, in __init__
    if self.login()==False: return
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 126, in login
    self.authenticate(user=user, pwd=pwd)
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 216, in authenticate
    self.user = self.check_password(user, pwd)
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 255, in check_password
    self.fail('Incorrect password', user=user)
  File "/home/jupiter/jupiter-bench/apps/frappe/frappe/auth.py", line 263, in fail
    raise frappe.AuthenticationError
frappe.exceptions.AuthenticationError

If I try to modify something in the user through the frontend, timeout occurs and the change is not saved.

How can I increase the log level for debugging? Is there another point I can make to create users again?

An update: Performing a Data Imports from a spreadsheet with the user template, the record is generated in the DB. So the freeze only occurs when inserting via web interface or via API