Ah, I see—passes in Python 2.7.3 for me, too. Now, I'm sorry to tell you,
those two tests still fail for me in Python 2.7.0 and 2.6.7 (versions I
happen to have on my machine).

*test_max_pool_size_with_leaked_request* fails, and *
test_max_pool_size_with_redundant_request* hangs.

I assume that's because 2.6.7 and 2.7.0 lack the threadlocal fix that was
introduced in 2.7.2. (Pity me that I know so much about threadlocals. The
knowledge cost me great suffering.) I suggest you test against 2.6.x and
reproduce the failures. To combat the behavior of threadlocals in 2.6, you
can probably just add a call to self._ident.get() somewhere in the pool
code or the test; this will trigger cleanup of any dead threads' locals and
return their sockets to the pool.

(I think I linked this before, but see
http://emptysquare.net/blog/knowing-when-a-python-thread-has-died/ )


On Wed, Apr 3, 2013 at 2:30 AM, Justin Patrin <notifications@github.com>wrote:

> In pymongo/pool.py:
>
> > @@ -363,16 +402,18 @@ def maybe_return_socket(self, sock_info):
> >      def _return_socket(self, sock_info):
> >          """Return socket to the pool. If pool is full the socket is discarded.
> >          """
> > -        try:
> > -            self.lock.acquire()
>
> If you had been using the debug branch that would explain the failures.
> I'd committed potential fixes there but went another direction in master.
> I've now essentially copied master to debug.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mongodb/mongo-python-driver/pull/163/files#r3631498>
> .
>