keystone/keystone
Lance Bragstad f36034c8a6 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.

Conflicts:
      keystone/tests/unit/test_backend_sql.py due to import order
      differences between train and ussuri. Also adjust the expected log
      message since the method path is different compared to older
      releases, which have the driver name in them (e.g., Identity).

Change-Id: I75590c20e90170ed862f46f0de7d61c7810b5c90
Closes-Bug: 1885753
(cherry picked from commit ceae3566e8)
(cherry picked from commit f47e635b80)
(cherry picked from commit 5b7d4c80d4)
(cherry picked from commit 07d3a3d3ff)
(cherry picked from commit d4f48fc4e5)
(cherry picked from commit 328cf33aab)
2021-03-31 12:33:43 +00:00
..
access_rules_config Add a permissive mode for access rules config 2019-03-03 18:33:49 +01:00
api Fix security issues with EC2 credentials 2020-05-06 08:18:16 -07:00
application_credential Add driver support for app cred access rules 2019-03-03 18:33:49 +01:00
assignment Delete system role assignments from system_assignment table 2020-10-30 16:04:07 +00:00
auth Emit CADF notifications on authentication for invalid users 2018-10-25 17:43:37 -07:00
catalog Region update extra support 2018-11-07 22:57:11 +00:00
cmd Ensure bootstrap handles multiple roles with the same name 2020-01-29 11:39:09 -06:00
common Revert "Blacklist bandit 1.6.0" 2019-06-24 06:52:52 -07:00
conf Check timestamp of signed EC2 token request 2020-05-02 21:36:47 -07:00
credential Add cadf auditing to credentials 2020-04-01 15:05:25 -03:00
endpoint_policy Convert policy API to flask 2018-08-31 07:14:32 +00:00
federation Fix wrong example for direct_maps 2019-02-11 22:46:48 +05:30
identity Retry update_user when sqlalchemy raises StaleDataErrors 2021-03-31 12:33:43 +00:00
limit Add domain level support for strict-two-level-model 2019-02-19 11:09:13 +08:00
locale Imported Translations from Zanata 2018-08-09 06:06:59 +00:00
models Ensure OAuth1 authorized roles are respected 2020-05-06 08:18:06 -07:00
oauth1 Revert "Blacklist bandit 1.6.0" 2019-06-24 06:52:52 -07:00
policy Convert policy API to flask 2018-08-31 07:14:32 +00:00
receipt Change __all__ list to tuple 2018-11-07 16:40:02 -06:00
resource Update project depth check 2019-02-19 11:09:13 +08:00
revoke Remove unused revoke_by_user_and_project 2018-09-14 04:08:01 +00:00
server Make system tokens work with domain-specific drivers 2019-10-17 21:42:15 +00:00
tests Retry update_user when sqlalchemy raises StaleDataErrors 2021-03-31 12:33:43 +00:00
token token: consistently decode binary types 2019-10-30 07:43:02 +00:00
trust Add abstract method in trusts base.py 2018-11-07 08:43:39 +05:30
__init__.py Revert "Disable eventlet monkey-patching of DNS" 2013-05-10 10:24:48 -04:00
exception.py Add JSON driver for access rules config 2019-03-03 18:33:11 +01:00
i18n.py Update links in keystone 2017-09-12 15:18:13 +08:00
notifications.py Always have username in CADF initiator 2020-02-20 01:42:35 +00:00
version.py bump Keystone version for Stein 2019-01-22 15:34:06 +13:00