Browse files

Fix connection pooling bug: don't close before reading.

If the connection pool is full when a connection is returned, the
connection was being closed before the response body was read.  Now,
the close() method is not explicitly called in put_http_connection;
instead, the connection will be closed when the object is garbage
  • Loading branch information...
1 parent 8992f88 commit 20e0d5ca712d510f4483045dc716cd1b39289ed2 @bwbeach bwbeach committed Jul 8, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 boto/
@@ -430,8 +430,11 @@ def put_http_connection(self, host, is_secure, connection):
self._pool[self._cached_name(host, is_secure)].put_nowait(connection)
except Queue.Full:
- # gracefully fail in case of pool overflow
- connection.close()
+ # Don't close the connection here, because the caller of
+ # _mexe, which calls this, has not read the response body
+ # yet. We'll just let the connection object close itself
+ # when it is freed.
+ pass
def proxy_ssl(self):
host = '%s:%d' % (, self.port)

0 comments on commit 20e0d5c

Please sign in to comment.