[Bug 1889396] Fix merged to networking-arista (stable/ussuri)

OpenStack Infra 1889396 at bugs.launchpad.net
Tue Sep 1 22:43:25 UTC 2020


Reviewed:  https://review.opendev.org/748761
Committed: https://git.openstack.org/cgit/x/networking-arista/commit/?id=8bc04050a8ca06d2930076d0955e771bed27dae3
Submitter: Zuul
Branch:    stable/ussuri

commit 8bc04050a8ca06d2930076d0955e771bed27dae3
Author: Aurelien Lourot <aurelien.lourot at canonical.com>
Date:   Wed Jul 29 13:52:44 2020 +0200

    Fix AttributeError on select.poll()
    
    Change-Id: Iefcae89cdedd13535c3135ca7227362f1cf9abc8
    Closes-Bug: #1889396
    Co-Authored-By: Mitchell Jameson <mitchell at arista.com>


** Tags added: in-stable-rocky

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

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

Status in Ubuntu Cloud Archive:
  Triaged
Status in Ubuntu Cloud Archive stein series:
  Fix Committed
Status in Ubuntu Cloud Archive train series:
  Fix Committed
Status in Ubuntu Cloud Archive ussuri series:
  Fix Committed
Status in networking-arista:
  Fix Released
Status in networking-arista package in Ubuntu:
  Triaged
Status in networking-arista source package in Focal:
  Triaged
Status in networking-arista source package in Groovy:
  Triaged

Bug description:
  [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. Note that this problem is already there anyway and this is what we intend to fix here.

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



More information about the Ubuntu-openstack-bugs mailing list