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
b756447bab

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
This commit is contained in:
Eric K 2018-02-02 15:22:36 -08:00 committed by Eric Kao
parent fd0143adf6
commit 919b782486
2 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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