Comment 2 for bug 1282089

Revision history for this message
Florent Flament (florentflament) wrote :

Hi,

I did some investigation, and there is only one session object used by each Keystone HTTPClient instance (superclass of v2_0.client.Client and v3.client.Client - https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/httpclient.py#L227). From my point of view, keystoneclient's behavior is right. The issue is when the application using python-keystoneclient instantiates many HTTPClient instances.

I can think of 2 possibles fixes:

* The application that uses python-keystoneclient uses as few HTTPClient instances as possible, which seems to be done in Horizon there: https://github.com/openstack/horizon/blob/master/openstack_dashboard/api/keystone.py#L164 . Although, there may be a bug, since the number of TCP connexions is increasing with each HTTP request done towards the console.

* The HTTPClient instance provides a method, that closes every opened connexions and releases any used resource. This method can be called by the application using python-keystoneclient whenever the client will not be used anymore (for instance using a 'with .. as ... :' block).