ip allocation can be taken after dup check before commit

Bug #1534447 reported by Kevin Benton
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Kevin Benton

Bug Description

A concurrent thread/server can use an IP allocation before the port creation that attempts to insert it on the local server gets a chance to commit its transaction to the database. So even though we have a dup check, it may return that the IP is not in use right before something else steals it.

http://logs.openstack.org/38/257938/9/gate/gate-neutron-dsvm-api/d98d247/logs/screen-q-svc.txt.gz?level=ERROR

Changed in neutron:
assignee: nobody → Kevin Benton (kevinbenton)
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/267930

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/267930
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=f67fc3cb08ce4f0e6fc685801a243fe68503578e
Submitter: Jenkins
Branch: master

commit f67fc3cb08ce4f0e6fc685801a243fe68503578e
Author: Kevin Benton <email address hidden>
Date: Thu Jan 14 20:23:32 2016 -0800

    Retry port create/update on duplicate db records

    Even though we have a duplicate IP check before creating an IP
    allocation, there is a window between when that check is completed
    and when the record is committed to the database. During this window,
    another thread or server may use the same IP address, which will result
    in the database commit failing with a DBDuplicateEntry exception.

    This patch adds a decorator to convert the exception into a
    RetryRequest, which will be caught at the API layer to start the
    operation over, at which point the normal duplicate check will find
    the IP and return the correct error to the user.

    This was done instead of trying to convert the DBDuplicate to the
    correct exception since it's on commit and there are possibly many
    different sources of the duplicate record beyond the IP allocation
    (depending on what mechanism drivers did during pre-commit, etc).
    By retrying the request, we ensure that the prechecks run again that
    will raise the appropriate exception.

    Change-Id: I37a964497bf60a61bc49bdeec94a008f167c384f
    Closes-Bug: #1534447

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 8.0.0.0b2

This issue was fixed in the openstack/neutron 8.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/270300

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/270300
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=2601fe06dbb8b84c8eb1c559854a6b20bf80833c
Submitter: Jenkins
Branch: stable/liberty

commit 2601fe06dbb8b84c8eb1c559854a6b20bf80833c
Author: Kevin Benton <email address hidden>
Date: Thu Jan 14 20:23:32 2016 -0800

    Retry port create/update on duplicate db records

    Even though we have a duplicate IP check before creating an IP
    allocation, there is a window between when that check is completed
    and when the record is committed to the database. During this window,
    another thread or server may use the same IP address, which will result
    in the database commit failing with a DBDuplicateEntry exception.

    This patch adds a decorator to convert the exception into a
    RetryRequest, which will be caught at the API layer to start the
    operation over, at which point the normal duplicate check will find
    the IP and return the correct error to the user.

    This was done instead of trying to convert the DBDuplicate to the
    correct exception since it's on commit and there are possibly many
    different sources of the duplicate record beyond the IP allocation
    (depending on what mechanism drivers did during pre-commit, etc).
    By retrying the request, we ensure that the prechecks run again that
    will raise the appropriate exception.

    Change-Id: I37a964497bf60a61bc49bdeec94a008f167c384f
    Closes-Bug: #1534447
    (cherry picked from commit f67fc3cb08ce4f0e6fc685801a243fe68503578e)

tags: added: in-stable-liberty
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 7.0.4

This issue was fixed in the openstack/neutron 7.0.4 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.