keystone/keystone
Lance Bragstad 07d3a3d3ff Retry update_user when sqlalchemy raises StaleDataErrors
Keystone's update_user() method in the SQL driver processes a lot of
information about how to update users. This includes evaluating password
logic and authentication attempts for PSI-DSS. This logic is evaluated
after keystone pulls the user record from SQL and before it exits the
context manager, which performs the write.

When multiple clients are all updating the same user reference, it's
more likely they will see an HTTP 500 because of race conditions exiting
the context manager. The HTTP 500 is due to stale data when updating
password expiration for old passwords, which happens when setting a new
password for a user.

This commit attempts to handle that case more gracefully than throwing a
500 by detecting StaleDataErrors from sqlalchemy and retrying.  The
identity sql backend will retry the request for clients that have
stale data change from underneath them.

Change-Id: I75590c20e90170ed862f46f0de7d61c7810b5c90
Closes-Bug: 1885753
(cherry picked from commit ceae3566e8)
(cherry picked from commit f47e635b80)
(cherry picked from commit 5b7d4c80d4)
2021-03-29 19:20:12 +00:00
..
api Fix security issues with EC2 credentials 2020-05-02 12:35:14 -07:00
application_credential Remove six usage 2020-01-30 06:06:51 +00:00
assignment Delete system role assignments from system_assignment table 2020-10-30 16:02:51 +00:00
auth Add expiring user group memberships on mapped authentication 2020-04-07 19:30:57 -04:00
catalog Remove six usage 2020-01-30 06:06:51 +00:00
cmd Merge "Default to bootstrapping roles as immutable" 2020-02-12 05:47:02 +00:00
common Merge "Add schema placeholders for Ussuri" 2020-04-23 21:19:52 +00:00
conf Check timestamp of signed EC2 token request 2020-04-30 20:25:13 +00:00
credential Remove six usage 2020-01-30 06:06:51 +00:00
endpoint_policy Remove six usage 2020-01-30 06:06:51 +00:00
federation Merge "Expiring Group Memberships API - Allow set idp authorization_ttl" 2020-04-10 09:37:50 +00:00
identity Retry update_user when sqlalchemy raises StaleDataErrors 2021-03-29 19:20:12 +00:00
limit Remove six usage 2020-01-30 06:06:51 +00:00
locale Imported Translations from Zanata 2020-04-26 07:04:33 +00:00
models Ensure OAuth1 authorized roles are respected 2020-05-02 12:35:10 -07:00
oauth1 Remove six usage 2020-01-30 06:06:51 +00:00
policy Remove six usage 2020-01-30 06:06:51 +00:00
receipt Remove six usage 2020-01-30 06:06:51 +00:00
resource Remove six usage 2020-01-30 06:06:51 +00:00
revoke Remove six usage 2020-01-30 06:06:51 +00:00
server Remove six usage 2020-01-30 06:06:51 +00:00
tests Retry update_user when sqlalchemy raises StaleDataErrors 2021-03-29 19:20:12 +00:00
token Remove six usage 2020-01-30 06:06:51 +00:00
trust Remove six usage 2020-01-30 06:06:51 +00:00
__init__.py Revert "Disable eventlet monkey-patching of DNS" 2013-05-10 10:24:48 -04:00
exception.py Remove six usage 2020-01-30 06:06:51 +00:00
i18n.py Fix translated response 2019-08-19 14:49:37 +08:00
notifications.py Always have username in CADF initiator 2020-01-09 15:55:48 +00:00
version.py Add expiring user group memberships on mapped authentication 2020-04-07 19:30:57 -04:00