I had another look and rewrote some of the pool code. Connection cleanup is now done in the client thread unless the connection is being returned from a dead thread. The dead thread return path now also checks that the connection returned still has its owner set to the dead thread (it could happen that a thread returns a connection and then subsequently dies; the manager thread would previously double-return the connection if it had been leased out to another client thread).
I also implemented a torture test for the connection pool and fixed a couple timing issues in the redis tests.
All tests pass on my machine.
I believe the tests now confirm that issues #8, #7, and #6
I had another look and rewrote some of the pool code. Connection cleanup is now done in the client thread unless the connection is being returned from a dead thread. The dead thread return path now also checks that the connection returned still has its owner set to the dead thread (it could happen that a thread returns a connection and then subsequently dies; the manager thread would previously double-return the connection if it had been leased out to another client thread).
I also implemented a torture test for the connection pool and fixed a couple timing issues in the redis tests.
All tests pass on my machine.
I believe the tests now confirm that issues #8, #7, and #6