pallets-eco / flask-debugtoolbar

A toolbar overlay for debugging Flask applications
https://flask-debugtoolbar.readthedocs.io
BSD 3-Clause "New" or "Revised" License
953 stars 146 forks source link

Maximum recursion RuntimeError after running for a while #128

Closed StoneMoe closed 1 year ago

StoneMoe commented 6 years ago
Traceback (most recent call last):
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/project/venv/lib/python3.4/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 1833, in finalize_request
response = self.process_response(response)
File "/project/venv/lib/python3.4/site-packages/flask/app.py", line 2112, in process_response
response = handler(response)
File "/project/venv/lib/python3.4/site-packages/flask_debugtoolbar/__init__.py", line 223, in process_response
toolbar_html = toolbar.render_toolbar()
File "/project/venv/lib/python3.4/site-packages/flask_debugtoolbar/toolbar.py", line 45, in render_toolbar
template = self.jinja_env.get_template('base.html')
File "/project/venv/lib/python3.4/site-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/project/venv/lib/python3.4/site-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
return loader.load(environment, name, globals)
File "/project/venv/lib/python3.4/site-packages/jinja2/loaders.py", line 405, in load
.........Many same output.........
RuntimeError: maximum recursion depth exceeded

Maybe related issue: https://github.com/kevinbeaty/flask-debug-api/issues/3

mgood commented 6 years ago

Can you still reproduce the error without the flask-debug-api panel loaded? It appears to be re-processing the set of URL rules before each request, which seems unnecessary and it might be leaking resources in some way that eventually fails.

StoneMoe commented 6 years ago

Yes, I can reproduce this, but really hard to.

I found this issue is MUCH fewer times happened and longer time flask can run after removing flask-debug-api panel.

The traceback in the first comment is the first time I ran flask after removing flask-debug-api.

I'll try to investigate for more details when I run into this problem again.

StoneMoe commented 6 years ago

Still no idea how to reproduce this, RecursionError just appear after running about 12hours. Only affect HTML pages and API works normally.

More: Running with uwsgi Using flask-debugtoolbar-mongo