ml2 "while True" assumes fresh data on transactions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Critical
|
Kevin Benton |
Bug Description
both delete_network and delete_subnet in ML2 use the following pattern:
while True:
with session.begin():
record = get_thing_from_db()
... Logic to determine if out of transaction cleaning should be done
if no_cleaning:
do_
The problem here is that it assumes it will get fresh data on each iteration. However, due to to the identity map pattern followed by sqlalchemy[1], new data will not be reflected in the 'record' var above on subsequent iterations if the primary key still exists in the DB.
This can lead to infinite loops on delete_subnet if a concurrent delete request (or network update) bumps the network revision number. This is because the network that is in the session will always have the stale revision number even though the lookup methods are called on each iteration.
This can be reproduced with the following steps:
1. Place a pdb breakpoint here: https:/
2. create a network with two subnets (ensure the dhcp agent is running so it gets an IP on each)
3. issue an API subnet delete call
4. first time breakpoint hits, nothing is looked up yet, so just continue
5. second time breakpoint hits, issue the following query in mysql: 'update standardattributes set revision_
6. continue
7. continue
8. continue
9. do this as long as you want :)
1. http://
Changed in neutron: | |
milestone: | none → newton-rc1 |
importance: | Undecided → Critical |
Fix proposed to branch: master /review. openstack. org/370920
Review: https:/