Comment 2 for bug 1947010

Revision history for this message
Nobuto Murata (nobuto) wrote :

2nd example: when polling a status with 5 seconds interval (= KeepAliveTimeout=5), the API request eventually fails with a fatal error. It's known to happen when the interval is exactly the same as KeepAliveTimeout discussed in multiple places, e.g.
https://github.com/psf/requests/issues/4664
https://bugs.python.org/issue41345

https://docs.openstack.org/python-keystoneclient/latest/using-sessions.html
====
from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient.v3 import client

import logging

logging.basicConfig(level=logging.DEBUG)

from time import sleep

auth = v3.Password(auth_url="https://192.168.151.112:5000/v3",
                   username="admin", password="MY_PASSWORD",
                   project_name="admin",
                   user_domain_name="admin_domain",
                   project_domain_name="admin_domain")

sess = session.Session(auth=auth,
    verify="/home/ubuntu/snap/openstackclients/common/root-ca.crt")
keystone = client.Client(session=sess)

while True:
    keystone.projects.list()
    sleep(5)
====

...

DEBUG:keystoneauth.session:GET call to identity for https://192.168.151.112:35357/v3/projects used request id req-37b4e617-3272-440e-90fe-bbfcebe0c865
[<Project description=Created by Juju, domain_id=default, enabled=True, id=32035470a7104dc28e51d52ccd4968c3, is_domain=False, links={'self': 'https://192.168.151.112:5000/v3/projects/32035470a7104dc28e51d52ccd4968c3'}, name=services, options={}, parent_id=default, tags=[]>, <Project description=Created by Juju, domain_id=fcc7fc21bd35421d9ceb4a9c0890f527, enabled=True, id=33d9a30eec2a4902b220ea0798746be9, is_domain=False, links={'self': 'https://192.168.151.112:5000/v3/projects/33d9a30eec2a4902b220ea0798746be9'}, name=services, options={}, parent_id=fcc7fc21bd35421d9ceb4a9c0890f527, tags=[]>, <Project description=Created by Juju, domain_id=29e509050afa4cc2b235eabb9e86a8ff, enabled=True, id=75f15e43071a49f488291b95b6245711, is_domain=False, links={'self': 'https://192.168.151.112:5000/v3/projects/75f15e43071a49f488291b95b6245711'}, name=admin, options={}, parent_id=29e509050afa4cc2b235eabb9e86a8ff, tags=[]>, <Project description=Bootstrap project for initializing the cloud., domain_id=default, enabled=True, id=acd0dacb48364de386d8a5faea47b6cf, is_domain=False, links={'self': 'https://192.168.151.112:5000/v3/projects/acd0dacb48364de386d8a5faea47b6cf'}, name=admin, options={}, parent_id=default, tags=[]>]
DEBUG:keystoneauth.session:REQ: curl -g -i --cacert "/home/ubuntu/snap/openstackclients/common/root-ca.crt" -X GET https://192.168.151.112:35357/v3/projects? -H "Accept: application/json" -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: {SHA256}dff1fb0579fd35bfe46ef6574aadfda8993582d4ea2514e13fed16c181dec24d"
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1344, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response