keystone/keystone/identity
Lance Bragstad ceae3566e8 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
2021-03-29 16:21:47 +00:00
..
backends Retry update_user when sqlalchemy raises StaleDataErrors 2021-03-29 16:21:47 +00:00
id_generators Support bytes type in generate_public_ID() 2021-01-11 07:52:58 -05:00
mapping_backends Remove six usage 2020-01-30 06:06:51 +00:00
shadow_backends Fix UserNotFound exception for expiring groups 2020-05-10 22:36:21 -07:00
__init__.py Convert /v3/users to flask native dispatching 2018-10-11 15:27:45 -07:00
core.py Update hacking for Python3 2020-04-15 07:17:58 +02:00
generator.py Remove six usage 2020-01-30 06:06:51 +00:00
schema.py Update hacking for Python3 2020-04-15 07:17:58 +02:00