-
Task
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
False
-
-
False
-
-
-
PIDONE 18.0.7, PIDONE 18.0.8
-
2
A bug in oslo.config causes a RuntimeError when configuration options are modified during iteration — for instance when calling CONF.mutate_config_files() during signal-based config reloads.
This issue was previously latent but surfaced after a refactor in oslo.service that changed how signals and restarts are handled (via dynamic backends and eventlet).
Error:
RuntimeError: dictionary changed size during iteration
def my_function(): for info in self._opts.values(): # <-- not safe if modified concurrently for group in self._groups.values(): for info in group._opts.values():
Fix:
for info in list(self._opts.values()):
The fix is minimal and safe. This ensures the iteration is stable, even if the dictionary is modified concurrently (e.g., by another thread or via signal reload). It does not change any behavior unless the dict is being modified at the exact same time.
✅ No logic change
✅ Prevents crash
✅ Thread-safe
✅ Fully backward-compatible
Motivation for Backport
This bug has existed since at least 2014 but only became visible due to changes in how oslo.service handles config reloads. The issue was confirmed in production-like functional tests in Neutron.
The fix solves a real crash triggered during config reload, and could affect any project using dynamic services, mutate_config_files(), or relying on SIGHUP.
Proposed Backport Branches
- stable/2025.1
- stable/2024.2
- stable/2024.1
- stable/2023.2