ML2 ensure_port_binding may be prone to race condition

Bug #1335226 reported by Armando Migliaccio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Robert Kukura

Bug Description

During method ensure_port_binding as of master:

https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/db.py#L59

A port can be retrieved, and if not available then created. This may be prone to reference constraint failures in highly concurrent environments.

Changed in neutron:
assignee: nobody → Armando Migliaccio (armando-migliaccio)
Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
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/104731

Changed in neutron:
status: Confirmed → In Progress
Changed in neutron:
assignee: Armando Migliaccio (armando-migliaccio) → Robert Kukura (rkukura)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/104731
Reason: Superseded by https://review.openstack.org/#/c/82945/

Kyle Mestery (mestery)
Changed in neutron:
milestone: none → juno-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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

commit b1677dcb80ce8b83aadb2180efad3527a96bd3bc
Author: Robert Kukura <email address hidden>
Date: Tue Mar 11 21:54:35 2014 -0400

    ML2: Bind ports outside transactions

    The ML2 plugin now calls the bind_port() operation on the registered
    mechanism drivers outside of any enclosing DB transaction. Ports are
    created or updated in one transaction, then a binding is established
    if possible, and finally a second transaction commits the binding
    result.

    With [re]binding moved outside the DB transaction that triggered it,
    it is now possible that multiple threads or processes will
    concurrently try to bind the same port, or that the port will be
    updated between transactions. Concurrent attempts to bind the same
    port are allowed to proceed, which results are used is resolved in the
    second transaction, and binding is retried if necessary.

    Improvements to the Cisco Nexus driver and unit tests from Rich Curran
    needed due to the binding changes are also included.

    Closes-Bug: 1276391
    Closes-Bug: 1335226
    Change-Id: I65dafc330d6e812dad0667d2383858504d0ba299

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

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

commit 0b30651678e1e2e574553272c0f9ab69418efe96
Author: armando-migliaccio <email address hidden>
Date: Thu Jul 3 17:00:44 2014 -0700

    Make ML2 ensure_dvr_port_binding more robust

    There is a remote chance that this operation may
    be prone to DB integrity errors, in case the binding
    is attempted on the same port twice.

    Ideally getter methods should not create, but this
    is a common Neutron (anti)-pattern that would be
    difficult to eradicate (at least in a single patch);
    so for now let's make this code more defensive.

    Related-bug: #1269131
    Related-bug: #1335226

    Change-Id: Ie6c57fd46f0752839814dbac5b14fae2364f973d

Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-2 → 2014.2
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.