← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1791233] Re: Redundant dynamic partial segments was allocated for the same network and physical_network

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/788714
Committed: https://opendev.org/openstack/neutron/commit/b993ebb407208bf04a7957a3d15c9ac482a1dd5c
Submitter: "Zuul (22348)"
Branch:    master

commit b993ebb407208bf04a7957a3d15c9ac482a1dd5c
Author: Sebastian Lohff <sebastian.lohff@xxxxxxx>
Date:   Wed Apr 28 14:53:46 2021 +0200

    Fix dynamic segment allocation race condition
    
    When two segments are concurrently created this could have resulted in
    both threads creating a segment, thus resulting in two segments with
    different segmentation ids. To prevent this we now introduce a new
    unique constraint onto the networksegments table, which requires
    (network_id, network_type, physical_network) to be unique, which allows
    only a single segment with a single segmentation id to exist per
    combination of these three values.
    
    With the constraint in place a DB error will be thrown, which will cause
    allocate_dynamic_segment() to be executed again and this time it will
    find the already existing segment. To make sure that no additional DB
    objects are created when segment creation failed we need to put all of
    the allocation code into a DB transaction.
    
    Change-Id: I407ae88d69ed971bf8d9a9b79120366f33bb56fd
    Closes-Bug: #1791233


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1791233

Title:
  Redundant dynamic partial segments was allocated for the same network
  and physical_network

Status in neutron:
  Fix Released

Bug description:
  We are expected to get the same partial segment allocated for specified
  network and physical_network by calling neutron.plugins.ml2.managers.TypeManager.allocate_dynamic_segment.

  
  but there is a race condition:
  1. Two processes call allocate_dynamic_segment function with specified
     network and physical_network simultaneously.
  2. Two processes both retrieve no allocated segment, and both allocate
     a new partial segment indeed.
  3. Two partial dynamic segments was allocated for the same network and
     physical_network.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1791233/+subscriptions



References