HTTP connections not closed by Connection.close()

Bug #1408616 reported by Stuart Bishop on 2015-01-08
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
Undecided
Unassigned

Bug Description

The swiftclient.client.Connection class defines a close() method, which is great. It sniffs the connection object, and if the underling connection defines a close() method calls it. This is also great. Unfortunately, the default HTTPConnection class does not define a close() method so the Connection.close() method is effectively a noop, and the HTTPConnection.requests_session instance is never closed and its connection pool never cleaned until garbage collection cleans things up. This exposes us to leaks and eventual file descriptor overflow if references to the Connection objects remain after they are closed.

Also see Bug #1247762, but that was pre-requests library and links to an abandoned review.

Simple fix is to add a close() method to HTTPConnection that calls self.requests_session.close()

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers