commit c1394f6e2d3e55a8d4e4332915d26fbfd5f4ee9e
Author: Stephen Finucane <email address hidden>
Date: Fri Dec 13 16:18:33 2019 +0000
Ensure option groups don't change during logging
oslo.config allows us to configure groups and options dynamically. This
can cause a race with our logging as we attempt to iterate through
option groups that are changing under our feet. This wouldn't be a huge
issue, since these are just logs are we can always log again, if needed,
but we store groups in a dictionary and Python doesn't like us changing
the size of a dict it's iterating through:
RuntimeError: dictionary changed size during iteration
Given that we're only reading through this option group and don't need
to worry about a group _disappearing_, the solution is pretty simple:
create a copy of our option group names ahead of time so we don't need
to worry about new ones coming and messing things up.
No tests are included since this is a race and the only way I see to
reproduce this would involve lots of ugly threading.
Change-Id: Id3b28465d645a24f0fcebff2dd68a9bd30e21594
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1856312
(cherry picked from commit e3e2ba55eeeb86a9bc0624bb2592e46583e839e7)
(cherry picked from commit 22c286c63b15b6f0acf6f696b98226a9257bf745)
(cherry picked from commit 0a9c6c156a6eedf149528fd853f72a8ddd83e147)
Reviewed: https:/ /review. opendev. org/699524 /git.openstack. org/cgit/ openstack/ oslo.config/ commit/ ?id=c1394f6e2d3 e55a8d4e4332915 d26fbfd5f4ee9e
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit c1394f6e2d3e55a 8d4e4332915d26f bfd5f4ee9e
Author: Stephen Finucane <email address hidden>
Date: Fri Dec 13 16:18:33 2019 +0000
Ensure option groups don't change during logging
oslo.config allows us to configure groups and options dynamically. This
can cause a race with our logging as we attempt to iterate through
option groups that are changing under our feet. This wouldn't be a huge
issue, since these are just logs are we can always log again, if needed,
but we store groups in a dictionary and Python doesn't like us changing
the size of a dict it's iterating through:
RuntimeError: dictionary changed size during iteration
Given that we're only reading through this option group and don't need
to worry about a group _disappearing_, the solution is pretty simple:
create a copy of our option group names ahead of time so we don't need
to worry about new ones coming and messing things up.
No tests are included since this is a race and the only way I see to
reproduce this would involve lots of ugly threading.
Change-Id: Id3b28465d645a2 4f0fcebff2dd68a 9bd30e21594 9bc0624bb2592e4 6583e839e7) 0acf6f696b98226 a9257bf745) 149528fd853f72a 8ddd83e147)
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1856312
(cherry picked from commit e3e2ba55eeeb86a
(cherry picked from commit 22c286c63b15b6f
(cherry picked from commit 0a9c6c156a6eedf