我看到第一次调用GCP API有时会挂起 - 并非总是如此。下面是堆栈跟踪。
我基于python 2.7,GCP SDK 1.5.5
序列:
http = httplib2.Http()
credentials = GoogleCredentials.get_application_default()
if http:
gcp = GCP_discovery.build('compute', 'v1', credentials=credentials, httt
p=http)
else:
gcp = GCP_discovery.build('compute', 'v1', credentials=credentials)
list = gcp.routes().list(project = project).execute(http=http)
最后一次调用gcp永远不会返回。使用其他API替换gcp.routes().list()
也会导致挂起。如果我重新启动,一切都会顺利进行。
File: "/opt/avi/python/bin/cloud_connector/baremetal/gcp_client.py", line 677, in _reconcile_all_vips
rtlist = gcp.routes().list(project=xpn_project).execute(http=http)
File: "/usr/local/lib/python2.7/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File: "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 833, in execute
method=str(self.method), body=self.body, headers=self.headers)
File: "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 160, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File: "/usr/local/lib/python2.7/dist-packages/oauth2client/transport.py", line 175, in new_request
redirections, connection_type)
File: "/usr/local/lib/python2.7/dist-packages/oauth2client/transport.py", line 282, in request
connection_type=connection_type)
File: "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1609, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File: "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1351, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File: "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1334, in _conn_request
content = response.read()
File: "/usr/lib/python2.7/httplib.py", line 578, in read
return self._read_chunked(amt)
File: "/usr/lib/python2.7/httplib.py", line 620, in _read_chunked
line = self.fp.readline(_MAXLINE + 1)
File: "/usr/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
File: "/usr/lib/python2.7/ssl.py", line 341, in recv
return self.read(buflen)
File: "/usr/lib/python2.7/ssl.py", line 260, in read
return self._sslobj.read(len)