I'll have to work up a more self contained test using mocks (the approach can be seen here: https://github.com/zzzeek/sqlalchemy/blob/master/test/engine/test_reconnect.py#L21) so that this can be tested completely - if overflow is counting incorrectly, the implication is that the pool will eventually not be able to deliver connections past the pool size, is that right? I'd like to reproduce that.
On Jul 1, 2013, at 5:48 PM, Navid Sheikhol Eslami <na...@navid.it> wrote: > I believe I have found a bug in QueuePool causing it to leak connections > during instantiation of _ConnectionFairy objects, when get_connection() > raises an exception. > > A simple way to reproduce this is to have a connection expire and simulate a > network issue to have get_connection() raise an exception. We increase the > internal connections counter _overflow in _do_get(), but as the weakref > handler _finalize_fairy() has not been setup yet, we never decrease _overflow > back despite the connection never being established in the first place. > > I have written a simple reproducer (http://pastebin.com/7iKVYWNn) and here is > its output: http://pastebin.com/F5b7L75K > > The solution for us was to add an exception handler for get_connection() to > ensure that _finalize_fairy() is called - here is the patch: > http://pastebin.com/uvurWhSV > > Looking forward to your comments > > Thanks > > -- Navid > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.