[Bug 1889396] Re: [SRU] ML2 plugin fails with "AttributeError: module 'select' has no attribute 'poll'"
Corey Bryant
1889396 at bugs.launchpad.net
Thu Sep 24 12:43:10 UTC 2020
This bug was fixed in the package networking-arista - 2019.1.9-0ubuntu1~cloud0
---------------
networking-arista (2019.1.9-0ubuntu1~cloud0) bionic-stein; urgency=medium
.
* d/gbp.conf: Create stable/stein branch and align with standard openstack gbp.conf.
* d/watch: Update path to pypi artifact.
* d/p/fix-attribute-error-on-select-poll.patch: Fix AttributeError on
select.poll() (LP: #1889396).
* New stable point release for OpenStack Stein (LP: #1888693).
* d/control: Align (Build-)Depends with upstream.
* d/p/skip-tests.patch: Skip tests that are failing in Ubuntu builds until
upstream bug is resolved (LP: #1848239)
** Changed in: cloud-archive/train
Status: Fix Committed => Fix Released
** Changed in: cloud-archive/stein
Status: Fix Committed => Fix Released
--
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:
Fix Committed
Status in Ubuntu Cloud Archive stein series:
Fix Released
Status in Ubuntu Cloud Archive train series:
Fix Released
Status in Ubuntu Cloud Archive ussuri series:
Fix Released
Status in networking-arista:
Fix Released
Status in networking-arista package in Ubuntu:
Fix Released
Status in networking-arista source package in Focal:
Fix Released
Status in networking-arista source package in Groovy:
Fix Released
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