Bug #6
closedDatasync error: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30
0%
Description
Semi-recent refactoring of datasync has caused an increase in number of simultaneous connections to the local DB. (Probably still need to look closer at that, seems like it uses "too many" somehow.)
Now the default config for SQLAlchemy pooling is: pool_size=5, max_overflow=10
(see docs).
Note that this means the pool will contain at most 5 connections normally, but if more are needed an additional 10 may be created, so ultimately 15 max connections. See also docs on Connection Pooling.
If datasync has multiple consumers for the local/default DB watcher, it's possible now that it needs more connections than pool allows for, in which case you'll get an error like:
TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30 (Background on this error at: http://sqlalche.me/e/13/3o7r)
For now, the only practical way to fix this is to increase pool size via config. This need only be done for datasync, e.g. the web app does not need an increased pool. So for example in /srv/envs/poser/app/datasync.conf
add:
[rattail.db]
# nb. datasync may need several simultaneous connections to local (default) db
default.pool_size = 15
default.max_overflow = 30
The above would use up to 15 connections in the pool normally, with additional 30 possible for overflow, i.e. ultimately 45 max connections.