_overflow miscalculation can cause hangs

Issue #223 resolved
Former user created an issue

QueuePool do_return_invalid needs to always decrement overflow, or eventually (assuming max_overflow >= 0) you'll try to do a blocking get on an empty Queue, and hang.

You can reproduce this with a DBProxy having a small pool_size, max_overflow=0, and just get a connection + invalidate it until you hang.

It's more clear that "always decrement on invalidation" is the correct policy when you consider that pool_size + _overflow represents the number of created connections that will go back into the queue when released; an invalidated connection should thus always result in _overflow -= 1.

Comments (1)

  1. Log in to comment