python - Flask-SQLAlchemy TimeoutError -
my backend configuration :
- ubuntu 12.04
- python 2.7
- flask 0.9
- flask-sqlalchemy
- postgres 9.2
i've got error message:
timeouterror: queuepool limit of size 5 overflow 10 reached, connection timed out, timeout 30
do need close explicitly db.session? shouldn't connection pool when session goes out of scope?
this happen if using debug=true
in application , have loaded several pages or api endpoints errored out.
the reason running debug version of app keeps live debugger open in error page. live debugger keeps around resources processing request, can examine them. means database connection can't recycled.
you shouldn't use debug mode production version of app (apart problems security risk), , debugger won't work anyway (it designed work flask test server, not gunicorn). therefore in prod solution turn off debug.
if have problem in dev using debug mode - limitation. shouldn't hitting dev server hard, or can increase limit. aware 15 connections plenty serve large number of concurrent requests when being recycled properly. it's in debug tend run out.
Comments
Post a Comment