Copy tenants dictionary before modification
Avoid modifying the abide's tenant dictionary in order to prevent exceptions in other threads that are concurrently iterating over the tenants dictionary. 2021-07-17 06:36:33,742 ERROR zuul.Scheduler: Error in periodic stats: Traceback (most recent call last): File "/opt/zuul/lib/python3.8/site-packages/zuul/scheduler.py", line 292, in runStats self._runStats() File "/opt/zuul/lib/python3.8/site-packages/zuul/scheduler.py", line 420, in _runStats for tenant in self.abide.tenants.values(): RuntimeError: OrderedDict mutated during iteration Change-Id: I497a8bbf2c9443aed90e6cb7cf0cd05adbf82b15
This commit is contained in:
parent
a2b8b975d0
commit
89cbbf8fd4
|
@ -2347,13 +2347,19 @@ class ConfigLoader(object):
|
|||
|
||||
"""
|
||||
if tenant_name not in unparsed_abide.tenants:
|
||||
del abide.tenants[tenant_name]
|
||||
# Copy tenants dictionary to not break concurrent iterations.
|
||||
tenants = abide.tenants.copy()
|
||||
del tenants[tenant_name]
|
||||
abide.tenants = tenants
|
||||
return None
|
||||
|
||||
unparsed_config = unparsed_abide.tenants[tenant_name]
|
||||
new_tenant = self.tenant_parser.fromYaml(
|
||||
abide, unparsed_config, ansible_manager, min_ltimes)
|
||||
abide.tenants[tenant_name] = new_tenant
|
||||
# Copy tenants dictionary to not break concurrent iterations.
|
||||
tenants = abide.tenants.copy()
|
||||
tenants[tenant_name] = new_tenant
|
||||
abide.tenants = tenants
|
||||
if len(new_tenant.layout.loading_errors):
|
||||
self.log.warning(
|
||||
"%s errors detected during %s tenant configuration loading",
|
||||
|
|
Loading…
Reference in New Issue