** Description changed:

  [Impact]
  When running the latest Neutron ML2 Arista plugin on Ubuntu 18.04 with Python 
3.6 I get:
  
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/networking_arista/ml2/arista_sync.py", 
line 255, in sync_loop
      sync_required = self.wait_for_sync_required()
    File "/usr/lib/python3/dist-packages/networking_arista/ml2/arista_sync.py", 
line 184, in wait_for_sync_required
      return self.wait_for_mech_driver_update(timeout)
    File "/usr/lib/python3/dist-packages/networking_arista/ml2/arista_sync.py", 
line 165, in wait_for_mech_driver_update
      resource = self.provision_queue.get(timeout=timeout)
    File "/usr/lib/python3.6/multiprocessing/queues.py", line 104, in get
      if not self._poll(timeout):
    File "/usr/lib/python3.6/multiprocessing/connection.py", line 257, in poll
      return self._poll(timeout)
    File "/usr/lib/python3.6/multiprocessing/connection.py", line 414, in _poll
      r = wait([self], timeout)
    File "/usr/lib/python3.6/multiprocessing/connection.py", line 903, in wait
      with _WaitSelector() as selector:
    File "/usr/lib/python3.6/selectors.py", line 348, in __init__
      self._poll = select.poll()
  AttributeError: module 'select' has no attribute 'poll'
  
  This is because arista_sync.py imports eventlet, which removes poll()
  from select as it is considered "non-green", see
  https://github.com/eventlet/eventlet/issues/608 . However earlier in
  mechanism_arista.py multiprocessing was imported, which then adjusted
  its implementation based on the fact that hasattr(select, 'poll') was
  True at that time.
  
  The first solution that comes to mind would be to import eventlet way
  earlier in the project, before any import to multiprocessing and
  selectors, see http://eventlet.net/doc/patching.html#monkeypatching-the-
  standard-library . But I couldn't find the perfect place for this.
  
  A cleaner solution (validated locally) is to import eventlet.queue.Queue
  instead of multiprocessing.Queue as we use this queue only to
  synchronise with en eventlet.greenthread. See
  http://eventlet.net/doc/modules/queue.html . So basically:
  
  --- a/networking_arista/ml2/mechanism_arista.py
  +++ b/networking_arista/ml2/mechanism_arista.py
  [...]
  -from multiprocessing import Queue
  +from eventlet.queue import Queue
  
  I'll open a review. Thanks!
  
  PS: I'm hitting this while extending the new OpenStack Neutron API
  Arista Plugin charm ( https://opendev.org/openstack/charm-neutron-api-
  plugin-arista ) in order to support the latest OpenStack releases.
  
  [Test Case]
+ Within the project itself:
+ 
https://opendev.org/x/networking-arista/src/branch/master/networking_arista/tests/unit/ml2/test_arista_sync.py#L31
 exercises the newly introduced imports.
+ 
+ Within a consuming project:
+ 
https://opendev.org/openstack/charm-neutron-api-plugin-arista/src/branch/master/src/tests/tests.yaml#L18
 has this code imported by neutron and validates that neutron runs, behaves as 
expected and succeeds at communicating with an Arista eAPI by creating/deleting 
networks.
  
  [Regression Potential]
+ A mistake in the touched code could lead to:
+ 1. neutron-server failing to start if the newly introduced imports don't work.
+ 2. neutron-server failing to communicate with an Arista eAPI if the 
monkey-patched multiprocessing.Queue doesn't behave as expected.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1889396

Title:
  [SRU] ML2 plugin fails with "AttributeError: module 'select' has no
  attribute 'poll'"

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/1889396/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to