mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Fix Tornado memory leak with synchronously handled requests.
The new Tornado handler tracking logic properly handled requests that threw an exception or followed the RespondAsynchronously code path, but did not properly de-allocated the handler in the syncronous case. An easy reproducer for this is to load a new Zulip browser window; that will leak 2 handler objects for the 2 synchronous requests made from Django to Tornado as part of initial state fetching.
This commit is contained in:
@@ -244,6 +244,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
|
||||
if response is RespondAsynchronously:
|
||||
async_request_stop(request)
|
||||
return None
|
||||
clear_handler_by_id(self.handler_id)
|
||||
except Exception as e:
|
||||
clear_handler_by_id(self.handler_id)
|
||||
# If the view raised an exception, run it through exception
|
||||
|
||||
Reference in New Issue
Block a user