← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1429492] Re: When host_manager sync the aggregates into host_state obj by iterate aggregates set in host_aggregates_map may trigger Runtime error

 

After rethinking:

host_state.aggregates = [self.aggs_by_id[agg_id] for agg_id in
                                      self.host_aggregates_map[
                                         host_state.host]]

is a single line loop, with eventlet this won't be changed at
concurrent.

** Changed in: nova
       Status: In Progress => Invalid

-- 
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/1429492

Title:
  When host_manager sync the aggregates into host_state obj by iterate
  aggregates set in host_aggregates_map may trigger Runtime error

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  This is just found by review.

  The host_manager sync aggregate to host_state obj as below:

   host_state.aggregates = [self.aggs_by_id[agg_id] for agg_id in
                                        self.host_aggregates_map[
                                           host_state.host]]

  It iterate the set directly. But at the same time, the aggregtes set
  can be updated concurrently.

  
  But when you change the size of set when iteration will trigger Runtime error:

  In [2]: s = set([1,2,3,4])

  In [3]: s
  Out[3]: {1, 2, 3, 4}

  In [4]: for i in s:
     ...:     print i
     ...:     if i == 3:
     ...:         s.add(5)
     ...:
  1
  2
  3
  ---------------------------------------------------------------------------
  RuntimeError                              Traceback (most recent call last)
  <ipython-input-4-c7399e78b688> in <module>()
  ----> 1 for i in s:
        2     print i
        3     if i == 3:
        4         s.add(5)
        5

  RuntimeError: Set changed size during iteration

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


References