← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1592983] Re: callback can't unsubscribe itself in python3

 

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

commit 2fbb6587df357583fe03b8616d7b95f79382af20
Author: Kevin Benton <kevin@xxxxxxxxxx>
Date:   Sat Jun 11 08:23:48 2016 -0700

    Allow self-unsubscribing callbacks
    
    This adjusts the notify loop logic to handle the case where
    a callback causes a subscription or unsubscription that changes
    the subscriber dictionary to change during iteration.
    
    It was just using .items() which solved the problem for py27 but
    was not creating an actual copy in py34. This just calls list()
    on .items() to make sure we get a list in both cases.
    
    Change-Id: Iee9d675faf30ec714b4f5c77128d8843d545ecfd
    Closes-Bug: #1592983


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

Title:
  callback can't unsubscribe itself in python3

Status in neutron:
  Fix Released

Bug description:
  The callback manager uses .items() which is not a copy of the
  subscribers dict in python3. This means that a callback that wants to
  unsubscribe itself will die in python3 with an error:

  
     b'    self.manager.notify(resources.PORT, events.BEFORE_CREATE, mock.ANY)'
      b'  File "/home/administrator/code/neutron/neutron/callbacks/manager.py", line 118, in notify'
      b'    errors = self._notify_loop(resource, event, trigger, **kwargs)'
      b'  File "/home/administrator/code/neutron/neutron/callbacks/manager.py", line 143, in _notify_loop'
      b'    for callback_id, callback in callbacks:'
      b'RuntimeError: dictionary changed size during iteration'
      b''

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


References