diff options
author | Slawek Kaplonski <skaplons@redhat.com> | 2021-09-03 16:04:02 +0200 |
---|---|---|
committer | Slawek Kaplonski <skaplons@redhat.com> | 2021-09-07 06:09:10 +0000 |
commit | c5e86f4f8f7e36233f383323e24e72dbe28efc04 (patch) | |
tree | 7c8b28e9b7d10e0d2bd56ab8de726264191fb6d4 | |
parent | a87ef16bc12171e52940ca1d60aae4f50f9610ba (diff) | |
download | neutron-18.1.1.tar.gz |
Don't use singleton in routes.middleware.RoutesMiddleware18.1.1
It seems that using default singleton=True in the
routes.middleware.RoutesMiddleware which is leading to use thread-local
RequestConfig singleton object is not working well with eventlet
monkeypatching of threading library which we are doing in Neutron.
As a result it leaks memory in neutron-api workers every time when API
request to not existing API endpoint is made by user.
To avoid that memory leak, let's use singletone=False in that
RoutesMiddleware object, at least until problem with thread-local
singleton and eventlet monkey patching will be solved.
Closes-Bug: #1942179
Change-Id: Id3a529248d3984506f0166bdc32e334127a01b7b
(cherry picked from commit e610a5eb9e71aa2549fb11e2139370d227787da2)
-rw-r--r-- | neutron/api/extensions.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index 51f1521270..4b36cae656 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -200,8 +200,13 @@ class ExtensionMiddleware(base.ConfigurableMiddleware): controller = req_controllers[request_ext.key] controller.add_handler(request_ext.handler) + # NOTE(slaweq): It seems that using singleton=True in conjunction + # with eventlet monkey patching of the threading library doesn't work + # well and there is memory leak. See + # https://bugs.launchpad.net/neutron/+bug/1942179 for details self._router = routes.middleware.RoutesMiddleware(self._dispatch, - mapper) + mapper, + singleton=False) super(ExtensionMiddleware, self).__init__(application) @classmethod |