【发布时间】:2013-06-07 21:24:00
【问题描述】:
我们的应用部署在 Google App Engine、Python 运行时 (2.7) 上并使用 Drive API。由于超过截止日期,它在不同的端点(Drive、OAuth 等)上越来越多地捕获HTTPException
我们实施了 5 次尝试的指数退避机制。我们的应用越来越多地达到这个限制(例如,今天早上我们遇到了很多这样的异常)。
这个问题的根源可能是什么?是否可以增加超时延迟?
感谢您的帮助。
这是一个完整的堆栈跟踪(OAuth2 API):
2013-06-07 21:11:10,851 ERROR An error occurred : Deadline exceeded while waiting for HTTP response from URL: https://accounts.google.com/o/oauth2/token
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~unishared-gae/production.367909734400765242/main.py", line 733, in get
creds = self.GetCodeCredentials() or self.GetSessionCredentials()
File "/base/data/home/apps/s~unishared-gae/production.367909734400765242/main.py", line 301, in GetCodeCredentials
creds = oauth_flow.step2_exchange(code)
File "lib/oauth2client/util.py", line 128, in positional_wrapper
return wrapped(*args, **kwargs)
File "lib/oauth2client/client.py", line 1283, in step2_exchange
headers=headers)
File "lib/httplib2/__init__.py", line 1570, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "lib/httplib2/__init__.py", line 1317, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "lib/httplib2/__init__.py", line 1286, in _conn_request
response = conn.getresponse()
File "/python27_runtime/python27_dist/lib/python2.7/httplib.py", line 500, in getresponse
raise HTTPException(str(e))
【问题讨论】:
-
您的 URLFetch 截止日期限制是多少?默认情况下,请求处理程序应该为 60 秒,并且远低于我们的平均 API 延迟。 developers.google.com/appengine/docs/python/urlfetch/…
-
我在 main.py 的开头尝试过: urlfetch.set_default_fetch_deadline(45) httplib2.Http(timeout=45) 但没有改变
-
这里有同样的问题,在this Google Groups post中也提到过。在我这边,它发生在打开 URL 后约 5 秒,在 60 年代之前。
-
得到了一位 Google 工程师 on this post 的确认,我们无能为力,因为这完全是 Google 方面的,他们正在努力解决这个问题。
-
很高兴知道!今天早上 Google OAuth2 似乎完全崩溃了。许多服务,包括我们的服务,都无法通过 Google 登录/注册访问。有什么相关信息吗?
标签: python google-app-engine google-api google-drive-api