← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2111584] Re: Failed get list of ports due to removed network

 

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

commit 20faede20096951f45dd87646075c21acd011793
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date:   Thu May 29 10:42:14 2025 +0000

    Do not create the min-bw request if the network segment is deleted
    
    This patch solves a race condition between a GET request of a port list
    and the ports and network deletion, that is a race condition corner
    case.
    
    When the network is deleted, the network segments are deleted too. In
    the ``_extend_port_resource_request_bulk`` method, used of bulk
    requests, the network segments are cached to speed up the call. In
    case the network segments of a specific network are deleted, now
    the minimum bandwidth request blob is not created because it requires
    the information of the network segments.
    
    The port GET request will finish returning the ports, including the
    deleted ones because they were retrieved from the database before the
    deletion.
    
    Closes-Bug: #2111584
    Change-Id: I5c3b7a958121ded17948eb6d6aaa43078ce71091


** 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/2111584

Title:
  Failed get list of ports due to removed network

Status in neutron:
  Fix Released

Bug description:
  I use zed version of Neutron with OVS driver, but looks like the same
  issue could be reproduced on master for OVN as well.

  - I have huge region with 1000+ ports
  - Run GET request for list of ports (/v2/ports?limit=0).  (which takes 10+ seconds)
  - exactly after running this command I delete one port with its network

  Finally I get: 500 on request and traceback on neutron-server api:

  """"
  IndexError: list index out of range
    File "pecan/core.py", line 693, in __call__
      self.invoke_controller(controller, args, kwargs, state)
    File "pecan/core.py", line 584, in invoke_controller
      result = controller(*args, **kwargs)
    File "neutron_lib/db/api.py", line 142, in wrapped
      setattr(e, '_RETRY_EXCEEDED', True)
    File "oslo_utils/excutils.py", line 227, in __exit__
      self.force_reraise()
    File "oslo_utils/excutils.py", line 200, in force_reraise
      raise self.value
    File "neutron_lib/db/api.py", line 138, in wrapped
      return f(*args, **kwargs)
    File "oslo_db/api.py", line 154, in wrapper
      ectxt.value = e.inner_exc
    File "oslo_utils/excutils.py", line 227, in __exit__
      self.force_reraise()
    File "oslo_utils/excutils.py", line 200, in force_reraise
      raise self.value
    File "oslo_db/api.py", line 142, in wrapper
      return f(*args, **kwargs)
    File "neutron_lib/db/api.py", line 190, in wrapped
      context_reference.session.rollback()
    File "oslo_utils/excutils.py", line 227, in __exit__
      self.force_reraise()
    File "oslo_utils/excutils.py", line 200, in force_reraise
      raise self.value
    File "neutron_lib/db/api.py", line 184, in wrapped
      return f(*dup_args, **dup_kwargs)
    File "neutron/pecan_wsgi/controllers/utils.py", line 65, in wrapped
      return f(*args, **kwargs)
    File "neutron/pecan_wsgi/controllers/resource.py", line 135, in index
      return self.get(*args, **kwargs)
    File "neutron/pecan_wsgi/controllers/resource.py", line 144, in get
      return {self.collection: self.plugin_lister(*lister_args,
    File "neutron_lib/db/api.py", line 226, in wrapped
      return f_with_retry(*args, **kwargs,
    File "neutron_lib/db/api.py", line 142, in wrapped
      setattr(e, '_RETRY_EXCEEDED', True)
    File "oslo_utils/excutils.py", line 227, in __exit__
      self.force_reraise()
    File "oslo_utils/excutils.py", line 200, in force_reraise
      raise self.value
    File "neutron_lib/db/api.py", line 138, in wrapped
      return f(*args, **kwargs)
    File "oslo_db/api.py", line 154, in wrapper
      ectxt.value = e.inner_exc
    File "oslo_utils/excutils.py", line 227, in __exit__
      self.force_reraise()
    File "oslo_utils/excutils.py", line 200, in force_reraise
      raise self.value
    File "oslo_db/api.py", line 142, in wrapper
      return f(*args, **kwargs)
    File "neutron_lib/db/api.py", line 190, in wrapped
      context_reference.session.rollback()
    File "oslo_utils/excutils.py", line 227, in __exit__
      self.force_reraise()
    File "oslo_utils/excutils.py", line 200, in force_reraise
      raise self.value
    File "neutron_lib/db/api.py", line 184, in wrapped
      return f(*dup_args, **dup_kwargs)
    File "oslo_db/sqlalchemy/enginefacade.py", line 1010, in wrapper
      return fn(*args, **kwargs)
    File "neutron/db/db_base_plugin_v2.py", line 1635, in get_ports
      resource_extend.apply_funcs(port_def.COLLECTION_NAME_BULK, items, None)
    File "oslo_utils/timeutils.py", line 319, in wrapper
      result = func(*args, **kwargs)
    File "neutron_lib/db/resource_extend.py", line 91, in apply_funcs
      resolved_func(response, db_object)
    File "neutron/services/qos/qos_plugin.py", line 300, in _extend_port_resource_request_bulk
      min_bw_request_group = QoSPlugin._get_min_bw_request_group(
    File "neutron/services/qos/qos_plugin.py", line 207, in _get_min_bw_request_group
      min_bw_traits = QoSPlugin._get_min_bw_traits(vnic_type, segments)
    File "neutron/services/qos/qos_plugin.py", line 256, in _get_min_bw_traits
      first_segment = segments[0]

  """"

  
  I suppose, that it happens because network was removed during request and there are no network segments (for this network) in DB. So segments in result equal to empty list.
  As result here: https://github.com/openstack/neutron/blob/5fbb3c1a3ffd895acb4869e54643c63981e38f34/neutron/services/qos/qos_plugin.py#L256 
  Getting the first element from empty list is failed.

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



References