From 919b78248643d7c84e7f0056831adfc9810ca396 Mon Sep 17 00:00:00 2001 From: Eric K Date: Fri, 2 Feb 2018 15:22:36 -0800 Subject: [PATCH] eventlet workaround to avoid import cycle issue Do get_hub() before monkey_patch() to workaround issue with import cycles in eventlet < 0.22.0; Based on the worked-around in eventlet with patch https://github.com/eventlet/eventlet/commit/b756447bab51046dfc6f1e0e299cc997ab343701 Also moved monkey_patch() up as far as possible to make sure all imports get patched modules. Closes-Bug: 1746136 Closes-Bug: 1745112 Conceptually cherry-picked from change I72c349e81dfc02136b22637c707ad4908c9f269e Change-Id: I0ed736f30f8fd7a3ec046e5810b84b52910fa4c9 --- congress/server/congress_server.py | 13 +++++++++++-- .../notes/eventlet-cycle-103edf0cfbafd947.yaml | 10 ++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/eventlet-cycle-103edf0cfbafd947.yaml diff --git a/congress/server/congress_server.py b/congress/server/congress_server.py index ec2f1d6ed..f7a85c3ac 100644 --- a/congress/server/congress_server.py +++ b/congress/server/congress_server.py @@ -18,11 +18,20 @@ from __future__ import print_function from __future__ import division from __future__ import absolute_import + +# NOTE(ekcs): monkey_patch ASAP to ensure all imports get patched modules +import eventlet +# NOTE(ekcs): get_hub() before monkey_patch() to workaround issue with +# import cycles in eventlet < 0.22.0; +# Based on the worked-around in eventlet with patch +# https://github.com/eventlet/eventlet/commit/b756447bab51046dfc6f1e0e299cc997ab343701 +# For details please check https://bugs.launchpad.net/congress/+bug/1746136 +eventlet.hubs.get_hub() +eventlet.monkey_patch() + import socket import sys -import eventlet -eventlet.monkey_patch() from oslo_config import cfg from oslo_log import log as logging from oslo_service import service diff --git a/releasenotes/notes/eventlet-cycle-103edf0cfbafd947.yaml b/releasenotes/notes/eventlet-cycle-103edf0cfbafd947.yaml new file mode 100644 index 000000000..c6e1edd27 --- /dev/null +++ b/releasenotes/notes/eventlet-cycle-103edf0cfbafd947.yaml @@ -0,0 +1,10 @@ +--- +prelude: > +fixes: + - | + On Ubuntu 16.04.3, an eventlet import cycle issue + can prevent Congress from starting. A workaround + is put in place in Congress to avoid this issue. + For more information, see the workaround released + in eventlet 0.22: + https://github.com/eventlet/eventlet/commit/b756447bab51046dfc6f1e0e299cc997ab343701