summaryrefslogtreecommitdiff
path: root/nova/monkey_patch.py
Commit message (Collapse)AuthorAgeFilesLines
* reenable greendns in nova.Sean Mooney2022-03-081-13/+2
| | | | | | | | | | | Back in the days of centos 6 and python 2.6 eventlet greendns monkeypatching broke ipv6. As a result nova has run without greendns monkey patching ever since. This removes that old workaround allowing modern eventlet to use greendns for non blocking dns lookups. Closes-Bug: #1964149 Change-Id: Ia511879d2f5f50a3f63d180258abccf046a7264e
* Correctly disable greendnsArtom Lifshitz2020-09-111-10/+13
| | | | | | | | | | | Previously, we were setting the environment variable to disable greendns in eventlet *after* import eventlet. This has no effect, as eventlet processes environment variables at import time. This patch moves the setting of EVENTLET_NO_GREENDNS before importing eventlet in order to correctly disable greendns. Closes-bug: 1895322 Change-Id: I4deed815c8984df095019a7f61d089f233f1fc66
* Remove eventlet hub workaround for monotonic clockMatthew Booth2020-05-221-8/+0
| | | | | | The fix landed in eventlet in 0.21.0 Change-Id: Icf7d671bc5d3f32831e6867c297e838f984d81b6
* Monkey patch original current_thread _activeCorey Bryant2020-02-121-0/+7
| | | | | | | | | Monkey patch the original current_thread to use the up-to-date _active global variable. This solution is based on that documented at: https://github.com/eventlet/eventlet/issues/592 Change-Id: I4872169413f27aeaff8d8fdfa5cdaf6ee32f4680 Closes-Bug: #1863021
* Bump to hacking 1.1.0Stephen Finucane2019-04-121-0/+1
| | | | | | | | | | | | This brings in a couple of new checks which must be addressed, many of which involve a rather large amount of changes, so these are ignored for now. A series of follow-up changes will resolved these. 'pycodestyle' is added as a dependency rather than it being pulled in transitively. This is necessary since we're using it in tests. Change-Id: I35c654bd39f343417e0a1124263ff31dcd0b05c9 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Eventlet monkey patching should be as early as possibleMatthew Booth2019-03-221-0/+97
We were seeing infinite recursion opening an ssl socket when running various combinations of python3, eventlet, and urllib3. It is not clear exactly what combination of versions are affected, but for background there is an example of this issue documented here: https://github.com/eventlet/eventlet/issues/371 The immediate cause in nova's case was that we were calling eventlet.monkey_patch() after importing urllib3. Specifically, change Ie7bf5d012e2ccbcd63c262ddaf739782afcdaf56 introduced the nova.utils.monkey_patch() method to make monkey patching common between WSGI and non-WSGI services. Unfortunately, before executing this method you must first import nova.utils, which imports a large number of modules itself. Anything imported (transitively) by nova.utils would therefore be imported before monkey patching, which included urllib3. This triggers the infinite recursion problem described above if you have an affected combination of library versions. While this specific issue may eventually be worked around or fixed in eventlet or urllib3, it remains true that eventlet best practises are to monkey patch as early as possible, which we were not doing. To avoid this and hopefully future similar issues, this change ensures that monkey patching happens as early as possible, and only a minimum number of modules are imported first. This change fixes monkey patching for both non-wsgi and wsgi callers: * Non-WSGI services (nova/cmd) This is fixed by using the new monkey_patch module, which has minimal dependencies. * WSGI services (nova/api/openstack) This is fixed both by using the new monkey_patch module, and by moving the patching point up one level so that it is done before importing anything in nova/api/openstack/__init__.py. This move causes issues for some external tools which load this path from nova and now monkey patch where they previously did not. However, it is unfortunately unavoidable to enable monkey patching for the wsgi entry point without major restructuring. This change includes a workaround for sphinx to avoid this issue. This change has been through several iterations. I started with what seemed like the simplest and most obvious change, and moved on as I discovered more interactions which broke. It is clear that eventlet monkey patching is extremely fragile, especially when done implicitly at module load time as we do. I would advocate a code restructure to improve this situation, but I think the time would be better spent removing the eventlet dependency entirely. Co-authored-by: Lee Yarwood <lyarwood@redhat.com> Closes-Bug: #1808975 Closes-Bug: #1808951 Change-Id: Id46e76666b553a10ec4654d4418a9884975b5b95