-
Notifications
You must be signed in to change notification settings - Fork 5.5k
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible leak when exception is raised in inner coroutine #3346
Comments
I wouldn't say it's "expected" (I do treat this kind of thing as a bug when I find it), but it's a fairly common consequence of the way the coroutine decorator and Runner work. It's reimplementing (in python) a lot of things that the python interpreter does, and especially on the exception-handling path it's really easy to get reference cycles through tracebacks. The answer is usually to FWIW the situation is improved with native (
So far we've always been able to fix these kinds of issues by fixing the coroutine runner so no workaround is needed in the application. I'd have to dig into this to see where exactly the issue is but with a reproducible test case it shouldn't be too hard. The relatively-new circlerefs_test.py is how I diagnose these issues and keep them from recurring. |
Hi, I have been debugging a memory leak in an application that uses Tornado and I was able to narrow down the behavior to what I believe is a representative minimum example, based on an existing unit test.
Edit:
master
as of a6dfd70 but from what I can tell this reproduces very far back to old versions of Tornado (e.g. 4.5+)Possibly related, from what I can gather (although closed for a long time now): #1872 #2229
I have a couple questions:
del
the local variables, but my fear is that in that case the remaining stack frames, tracebacks etc. would stick around, possibly resulting in other leaked variables that aren'tdel
eted (particularly if the exception is bubbled through several coroutines in a more complicated example).Here is the test I'm reproducing with, adapted from the existing one in
gen_test.py
:Thanks!
The text was updated successfully, but these errors were encountered: