Comments (1)
Is this expected behavior / is there some reason I'm missing for why a reference cycle forms here? I don't have a ton of experience with Tornado directly so maybe this is just a side effect of how the IOLoop is implemented or something, and it's expected that GC is needed to clean up in this scenario.
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 del
a local variable somewhere in tornado.gen.Runner
.
FWIW the situation is improved with native (async def
) coroutines, although I think the issue is still more likely to occur than in normal synchronous code.
Is there a "correct" workaround that would help free the exception / traceback, etc.?
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.
from tornado.
Related Issues (20)
- RFE: please start making github releases HOT 2
- Exclude test files from install HOT 6
- Incorrect type annotation on chain_future method
- Python 3.12 manylinux wheels HOT 2
- tornado 6.3.3 with gevent 23.7.0 hangup HOT 1
- Content-length validation does not handle spaces HOT 7
- How to set timeout on an Application and/or HTTPServer HOT 1
- `tornado.process.Subprocess()` hangs forever in `write()` for large data HOT 1
- httpclient_test: test_destructor_log is flaky on windows
- Python 3.11.5 error in ioloop.py HOT 3
- Inaccurate typing on HTTPHeaders
- py3.12: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal HOT 4
- Inaccurate typing for body/query argument getters
- High CPU consumption when upgrade to tornado > 5 HOT 2
- Can I write a single decorator combining @tornado.gen.coroutine and @run_on_executor. HOT 2
- iostream: SSL logging is too noisy
- Tornado was blocked for more than 1 second in HOT 1
- static_url with a prefix does not work in a Template tag HOT 2
- how to handle the http stream data without using callback but based on coroutine? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tornado.