【发布时间】:2015-07-24 16:23:53
【问题描述】:
我们的集成平台现在每天都会收到几个“无法获取 URL:...”错误。我不知道这是什么原因。
首先 GAE 尝试通过 BigQuery API 使用 OAuth2 从应用程序内部向 BigQuery 进行授权。它每秒尝试超过 30 秒(这只是 30 条类似行中的 1 条):
2015-05-12 05:59:02.727
URL being requested: https://www.googleapis.com/bigquery/v2/projects/XXX/jobs/job_w-z5K2zQObXeSaLy3hx7m4FOMXc?alt=json
下面是跟踪本身(就在上面显示的日志之后):
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/connectors/connector_XXX_v1_0.py", line 189, in send
status = self._verify_status(resp, content)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/connectors/connector_XXX_v1_0.py", line 250, in _verify_status
jobId=jobReference).execute()
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/oauth2client/util.py", line 128, in positional_wrapper
return wrapped(*args, **kwargs)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/apiclient/http.py", line 676, in execute
body=self.body, headers=self.headers)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/oauth2client/util.py", line 128, in positional_wrapper
return wrapped(*args, **kwargs)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/oauth2client/client.py", line 490, in new_request
redirections, connection_type)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/httplib2/__init__.py", line 1570, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/httplib2/__init__.py", line 1317, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/base/data/home/apps/s~XXX/processes:uno.383135852015228853/modules/httplib2/__init__.py", line 1286, in _conn_request
response = conn.getresponse()
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/gae_override/httplib.py", line 536, in getresponse
'An error occured while connecting to the server: %s' % e)
error: An error occured while connecting to the server: Unable to fetch URL: https://www.googleapis.com/bigquery/v2/projects/XXX/jobs/job_d_ONsjBebYjreJuDD-ZdEqCHYv0?alt=json
这些来自从 Google Datastore 获取数据并加载到 BigQuery 的进程。
这些错误是不确定的。有时它们会发生。有时不要。我在这里看不到任何模式。
需要注意的一点:直到 2015 年 5 月 1 日,这些流程都没有问题。数据轻松加载到 BQ。
我的假设是它可能与 OAuth2.0 有某种关系。我们使用
oauth2client v1.1。最新的是 1.4.7。也许更新会有所帮助?还是问题出在其他地方?
【问题讨论】:
-
我对可能的答案很感兴趣。自同一日期以来,我们遇到了完全相同的问题。
-
是超时问题吗?尝试增加 GAE 中的连接和读取超时
-
@pinoyyid 如何更改连接和读取超时?
-
您可以设置请求的最后期限,即服务等待响应的最长时间。默认情况下,获取的最后期限是 5 秒。 HTTP 请求的最长期限为 60 秒,任务队列和 cron 作业请求的最长期限为 60 秒。使用 URLConnection 接口时,服务使用连接超时(setConnectTimeout())加上读取超时(setReadTimeout())作为截止时间。
-
@pinoyyid 我没有提到的是我们使用 Python。据我所知,这些方法仅在 Java 中可用。
标签: python-2.7 google-app-engine google-oauth google-bigquery oauth2client