Reputation: 136635
I get
TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30
I have seen the questions:
as well as their answers. I tried them and I tried to reproduce my problem in a very simplified codebase. I can't reproduce it.
What can I do to find / fix the problem?
For example, can I get the current "usage" of the QueuePool within Python?
(Also, but probably better another question: Why shouldn't I set the queue overflow to -1?)
What I didn't try so far is setting app.config['SQLALCHEMY_POOL_RECYCLE']
(to be set here). I guess I would have to set it to a low value in order to fix this problem, but I might get timeouts in other places then, right?
Upvotes: 6
Views: 7508
Reputation: 12252
Run show PROCESSLIST
against your MySQL database to show the connections / pool / usage.
TimeoutError: QueuePool limit of size 10 overflow 10 reached
(10 + 10 = 20).threaded=True
, I only ever saw one connection open.Commit or stash all of your existing changes, then create a branch and start stripping out code / simplifying your app piece-by-piece and seeing if the issue still pops up.
(In combination with #2) Try reducing the SQLALCHEMY_POOL_SIZE
Flask-SQLAlchemy setting to make it quicker to reproduce the bug.
Upvotes: 2