dhcp bulk reload fails with python3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
High
|
Boyvinall |
Bug Description
In ussuri, configuring the neutron.conf bulk_reload_
With the current ussuri code, which looks unchanged on master, I get the following error in docker logs:
---
Running command: 'neutron-dhcp-agent --config-file /etc/neutron/
+ exec neutron-dhcp-agent --config-file /etc/neutron/
Traceback (most recent call last):
File "/usr/lib/
timer()
File "/usr/lib/
cb(*args, **kw)
File "/usr/lib/
waiter.switch()
File "/usr/lib/
for network_id in self._network_
RuntimeError: dictionary changed size during iteration
---
After this, I see no further updates to the dnsmasq hosts file.
The current code looks like this:
https:/
---
def _reload_
while True:
for network_id in self._network_
del self._network_
---
I think the problem is the "del" statement .. code like this works in python2 but not in python3. However, I also wonder if there's some race hazard here with new IDs being appended.
I suspect something like this might work better:
---
def _reload_
while True:
deleted = self._network_
for network_id in deleted:
---
However, even this is probably susceptible to a race hazard. Probably need a mutex around any update to self._network_
Changed in neutron: | |
assignee: | nobody → Boyvinall (boyvinall) |
Changed in neutron: | |
assignee: | nobody → Boyvinall (boyvinall) |
tags: | added: neutron-proactive-backport-potential |
Strange we haven't seen this before, thanks for filing the bug.
I think doing something like you propose would work, and it shouldn't need the copy()
while True: bulk_allocation s _network_ bulk_allocation s = {} get_network_ by_id(network_ id)
self.call_ driver( 'bulk_reload_ allocations' , network) greenthread. sleep(self. conf.bulk_ reload_ interval)
to_reload = self._network_
self.
for network_id in to_reload:
network = self.cache.
eventlet.