ironic/ironic
Dmitry Tantsur 5471157e4f Fixes a race condition in the hash ring code
The current hash ring code suffers from several problems:

1. The cache is reset on any get_topic_for call, which means that the
   cache is not used between API calls. Previously it was done to work
   around the situation when a new conductor is not visible until the API
   process restarts. Currently we refresh the hash rings periodically.

   This patch removes resetting the cache. To avoid waiting 2 minutes to
   be able to use a new driver:
   1) the hash ring cache is always rebuilt when a ring is not found,
   2) the hash_ring_reset_interval option was changed to 15 seconds.

2. The reset of the cache races with the hot path in the get_ring call.
   It is possible that the reset happens after the class-level cache
   variable is checked but before it is used, yielding None.

   This patch stores the value of the class-level variable to a local
   variable before checking, thus ensuring None is never returned.

Finally, some logging was added to the modified code to make this kind
of problems more debugable in the future.

Change-Id: I6e18c6ec23a053b59c76fcadd52b13d84d81b4fb
Story: #2003966
Task: #26896
Partial-Bug: #1792872
2018-10-05 07:36:30 -04:00
..
api Merge "Prevent HTML from appearing in API error messages" 2018-10-01 08:48:01 +00:00
cmd Detect skip version upgrades from version earlier than Pike 2018-07-06 12:46:14 -04:00
common Fixes a race condition in the hash ring code 2018-10-05 07:36:30 -04:00
conductor Fixes a race condition in the hash ring code 2018-10-05 07:36:30 -04:00
conf Fixes a race condition in the hash ring code 2018-10-05 07:36:30 -04:00
db Add automated_clean field 2018-08-20 10:25:24 +02:00
dhcp Merge "Add meaningful exception in Neutron port show" 2018-03-16 13:49:39 +00:00
drivers Merge "Disable periodic tasks if interval set to 0" 2018-10-02 23:46:09 +00:00
hacking Follow-up to improve pep8 checking with hacking 2018-07-26 10:29:41 +07:00
objects Use max version of an object 2018-08-02 13:43:51 +00:00
tests Fixes a race condition in the hash ring code 2018-10-05 07:36:30 -04:00
__init__.py Move eventlet monkey patch code 2017-03-02 13:48:18 +02:00
version.py Correct version.py and update current version string 2014-03-21 13:50:05 -07:00