ipavailabilityranges race condition when allocating from same range on multiple neutron-servers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
High
|
Hua Zhang |
Bug Description
Lets say that we start with an allocation_pool_id that looks like this:
+------
| allocation_pool_id | first_ip | last_ip |
+------
| 0f175416-
+------
We then allocate a few of those IPs, let's say 10-20, our pool now looks like this:
+------
| allocation_pool_id | first_ip | last_ip |
+------
| 0f175416-
+------
Now, we try and free a couple of those IPs, let's say 16, 17 and 18 now we have this in the db:
+------
| allocation_pool_id | first_ip | last_ip |
+------
| 0f175416-
| 0f175416-
+------
The race condition I'm about to describe will probably hamper the above operation, but that's okay. Let's just pretend for the sake of illustration. Now let's suppose that I have 2 neutron-servers running, one gets a request to allocate 192.168.1.16 and the other gets a request to free 192.168.1.15. Both servers are going to generate UPDATEs to the DB, they will look something like this:
SERVER 1: UPDATE ipavailabilityr
SERVER 2: UPDATE ipavailabilityr
Depending on order, how busy your neutron-servers are and how busy your database is one of the above statements is going to fail. That's okay, it reports the failure up through the API, the issue we see is that retries also tend to fail since usually only one operation affecting a single row in the table ever succeeds. If you have a very active neutron API and lots of free and allocate requests you end up getting into a very unusable state where active periods for the API are full of errors and get bogged down and fail until activity stops.
This is one example of the race condition. There are obviously other ways to trigger it if you sit down and look at the applicable piece of code. Some kind of concurrency management is probably in order, not sure what the best way to solve this would be however...
Changed in neutron: | |
importance: | Undecided → High |
status: | New → Confirmed |
Changed in neutron: | |
assignee: | nobody → Hua Zhang (zhhuabj) |
Changed in neutron: | |
milestone: | none → icehouse-3 |
Changed in neutron: | |
status: | Fix Committed → Fix Released |
Changed in neutron: | |
milestone: | icehouse-3 → 2014.1 |
Fix proposed to branch: master /review. openstack. org/43275
Review: https:/