14.0 auth_saml hanging queries after successful login
PCatinean opened this issue · 1 comments
Module
auth_saml
Describe the bug
After successful login the connection hangs after the redirect at the auth_saml/signin endpoint.
Checking postgresql for hanging/blocked queries returned transactions such as updating last login date or selection of saml_token
To Reproduce
Affected versions:
14.0 (most likely 15.0)
Steps to reproduce the behavior:
- Login via SSO
Expected behavior
Transactions go through and login finishes.
Additional context
Refactored version for auth_saml, deployed on odoo.sh
What we noticed so far is that if we execute cr.commit() at two points this behavior stops (see patch below)
My suspicion is that these new cursors do not get terminated/closed and remain in idle indefinitely.
diff --git a/auth_saml/controllers/main.py b/auth_saml/controllers/main.py
index 85317c5..88e2dd5 100644
--- a/auth_saml/controllers/main.py
+++ b/auth_saml/controllers/main.py
@@ -224,6 +224,7 @@ class AuthSAMLController(http.Controller):
url = "/#action=%s" % action
elif menu:
url = "/#menu_id=%s" % menu
+ cr.commit()
return login_and_redirect(*credentials, redirect_url=url)
except odoo.exceptions.AccessDenied:
diff --git a/auth_saml/models/res_users.py b/auth_saml/models/res_users.py
index 3194d1d..168c383 100644
--- a/auth_saml/models/res_users.py
+++ b/auth_saml/models/res_users.py
@@ -54,8 +54,9 @@ class ResUser(models.Model):
# to other envs, like the one used in login_and_redirect
user_saml.with_env(new_env).write({"saml_access_token": saml_response})
- if validation.get("mapped_attrs", {}):
- user.write(validation.get("mapped_attrs", {}))
+ if validation.get("mapped_attrs", {}):
+ user.write(validation.get("mapped_attrs", {}))
+ new_cr.commit()
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.