← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1685226] [NEW] uninitialized local variable ‘sibling_set’ referenced before assignment.

 

Public bug reported:

The code is using a variable which can be not defined if sibling_sets
(plural) is empty.

        # NOTE(sfinucan): If siblings weren't available and we're using PREFER
        # (implicitly or explicitly), fall back to linear assignment across
        # cores
        if (instance_cell.cpu_thread_policy !=
                fields.CPUThreadAllocationPolicy.REQUIRE and
                not pinning):
            pinning = list(zip(sorted(instance_cell.cpuset),
                                 itertools.chain(*sibling_set)))  <-----not defined if sibling_sets is empty

So far the only path I could see to be in a situation where sibling_sets
is empty at this step would be if two instances get scheduled "in same
time" in the same host where we could consider that all the checks to
ensure that the host cell provides enough cpus to handle the request
have been accepted.

Even if that could happen only in such circumstance which should fix the
issue.

[0]
https://github.com/openstack/nova/blob/master/nova/virt/hardware.py#L882

** Affects: nova
     Importance: Undecided
     Assignee: sahid (sahid-ferdjaoui)
         Status: New


** Tags: numa

** Changed in: nova
     Assignee: (unassigned) => sahid (sahid-ferdjaoui)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1685226

Title:
  uninitialized local variable ‘sibling_set’ referenced before
  assignment.

Status in OpenStack Compute (nova):
  New

Bug description:
  The code is using a variable which can be not defined if sibling_sets
  (plural) is empty.

          # NOTE(sfinucan): If siblings weren't available and we're using PREFER
          # (implicitly or explicitly), fall back to linear assignment across
          # cores
          if (instance_cell.cpu_thread_policy !=
                  fields.CPUThreadAllocationPolicy.REQUIRE and
                  not pinning):
              pinning = list(zip(sorted(instance_cell.cpuset),
                                   itertools.chain(*sibling_set)))  <-----not defined if sibling_sets is empty

  So far the only path I could see to be in a situation where
  sibling_sets is empty at this step would be if two instances get
  scheduled "in same time" in the same host where we could consider that
  all the checks to ensure that the host cell provides enough cpus to
  handle the request have been accepted.

  Even if that could happen only in such circumstance which should fix
  the issue.

  [0]
  https://github.com/openstack/nova/blob/master/nova/virt/hardware.py#L882

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