Traceback (most recent call last): File "/…/site-packages/sqlalchemy/pool.py", line 1122, in _do_get return self._pool.get(wait, self._timeout) File "/…/site-packages/sqlalchemy/util/queue.py", line 156, in get raise Emptysqlalchemy.util.queue.Empty
During handling of the above exception, another exception occurred:
[…]
File "/…/site-packages/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect return fn() File "/…/site-packages/sqlalchemy/pool.py", line 387, in connect return _ConnectionFairy._checkout(self) File "/…/site-packages/sqlalchemy/pool.py", line 766, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/…/site-packages/sqlalchemy/pool.py", line 516, in checkout rec = pool._do_get() File "/…/site-packages/sqlalchemy/pool.py", line 1131, in _do_get (self.size(), self.overflow(), self._timeout))sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 0 reached, connection timed out, timeout 30sqlalchemy.pool_size = 5sqlalchemy.max_overflow = 0--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/6c2f13c2-ea4d-4f9d-9d47-50dc98c6e583%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
In general I strongly urge you to reconsider using subrequests... they are there for people to use but they have lots of drawbacks versus just calling a bunch of reusable functions.
Assuming you have 1 request and 5 subrequests, shouldn't there only be 2 connections needed in the pool (i.e. the main request establishes a first connection, then subrequest 1 establishes a second connection which is re-used by 2-5)? You wouldn't be able to save a connection like this if you had recursive subrequests - but that would be a design flaw in the application logic.
If you're connecting to sqlalchemy during your setup, you can screw up the connection pool unless you call `engine.dispose()` (see a thread from a few weeks ago), because SqlAlchemy's connections and pool aren't forksafe or threadsafe.
I'm not sure what you mean here: "during setup" meaning when the app starts, or when the request is being handled?
From within the view function (i.e. handling the incoming request) I issue 5 subrequests one after the other. Doing so I noticed that the number of subrequests was bound by the pool_size + max_overflow, hence my question here and in the SQLA group.
How are you handling your session connection and cleanup? Are you using pyramid_tm? If so, are you using the `use_tween` on the invoke_subrequest to properly close each connection in the pool? If not, how are you cleaning up your connections?
I’ve followed the suggested cookie cutter code exactly: https://github.com/Pylons/pyramid-cookiecutter-alchemy, which uses pyramid_tm and adds the SQLA session to that transaction manager.