简体   繁体   English

App Engine:API调用文件。Create()花费的时间太长,因此已被取消

[英]App Engine: The API call file.Create() took too long to respond and was cancelled

When I try to write to blobstore using the same example provided in the docs (below), it works every time on dev server, but fails 100% of the time on appspot with this error: The API call file.Create() took too long to respond and was cancelled. 当我尝试使用docs(如下)中提供的相同示例写入blobstore时,它每次都可以在开发服务器上运行,但是在apppot上有100%的时间失败,并出现以下错误: The API call file.Create() took too long to respond and was cancelled. Googling show that this is a rare issue although some have reported it. 谷歌搜索表明,这是一个罕见的问题,尽管有人报告过。 Any idea what's going on here? 知道这里发生了什么吗?

I'm using Python 2.6 on dev server so that maybe why I'm not seeing this during dev. 我在开发服务器上使用Python 2.6,所以也许为什么我在开发期间没有看到这个。

from __future__ import with_statement
from google.appengine.api import files

# Create the file
file_name = files.blobstore.create(mime_type='application/octet-stream')

# Open the file and write to it
with files.open(file_name, 'a') as f:
  f.write('data')

# Finalize the file. Do this before attempting to read it.
files.finalize(file_name)

# Get the file's blob key
blob_key = files.blobstore.get_blob_key(file_name)

Traceback: 追溯:

The API call file.Create() took too long to respond and was cancelled.
Traceback (most recent call last):
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1516, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1510, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1258, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1082, in __call__
    return handler.dispatch()
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 552, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 550, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/main.py", line 43, in get
    file_name = files.blobstore.create(mime_type='text/html')
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/blobstore.py", line 69, in create
    return files._create(_BLOBSTORE_FILESYSTEM, params=params)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/file.py", line 491, in _create
    _make_call('Create', request, response)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/file.py", line 234, in _make_call
    rpc.check_success()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 558, in check_success
    self.__rpc.CheckSuccess()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 133, in CheckSuccess
    raise self.exception
DeadlineExceededError: The API call file.Create() took too long to respond and was cancelled.
Saved; key: __appstats__:082400, part: 41 bytes, full: 5691 bytes, overhead: 0.000 + 0.004; link: http://czongae.appspot.com/_ah/stats/details?time=1328696282404
<class 'google.appengine.runtime.apiproxy_errors.DeadlineExceededError'>: The API call file.Create() took too long to respond and was cancelled.
Traceback (most recent call last):
  File "/base/data/home/apps/s~czongae/1.356669185377832769/main.py", line 72, in <module>
    main()
  File "/base/data/home/apps/s~czongae/1.356669185377832769/main.py", line 69, in main
    app.run()
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1595, in run
    _webapp_util.run_wsgi_app(self)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
    run_bare_wsgi_app(add_wsgi_middleware(application))
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/util.py", line 118, in run_bare_wsgi_app
    for data in result:
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/appstats/recording.py", line 924, in appstats_wsgi_wrapper
    result = app(environ, appstats_start_response)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1524, in __call__
    response = self._internal_error(e)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1516, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1510, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1258, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 1082, in __call__
    return handler.dispatch()
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 552, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/webapp2.py", line 550, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~czongae/1.356669185377832769/main.py", line 43, in get
    file_name = files.blobstore.create(mime_type='text/html')
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/blobstore.py", line 69, in create
    return files._create(_BLOBSTORE_FILESYSTEM, params=params)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/file.py", line 491, in _create
    _make_call('Create', request, response)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/file.py", line 234, in _make_call
    rpc.check_success()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 558, in check_success
    self.__rpc.CheckSuccess()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 133, in CheckSuccess
    raise self.exception

It's not documented to the official manual. 它没有记录在官方手册中。 but try to add exclusive_lock=True when you open the file. 但是在打开文件时尝试添加exclusive_lock=True During the migration of my blobstore from M/S to HRD I think I had this problem. 我将Blobstore从M / S迁移到HRD期间,我认为我遇到了这个问题。

http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/files/file.py#402 http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/files/file.py#402

# Open the file and write to it
with files.open(file_name, 'a', exclusive_lock=True) as f:
  f.write('data')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GAE数据存储区还原因API调用urlfetch.Fetch()花费了太长时间而无法响应,因此被取消 - GAE datastore restore stops with The API call urlfetch.Fetch() took too long to respond and was cancelled Django Heroku,无法访问此站点,响应时间过长 - Django Heroku, This site can’t be reached, Took too long to respond Mlagents-learn train:“Unity 环境响应时间太长。” - Mlagents-learn train: "The Unity environment took too long to respond." API调用的响应时间太长。 我如何通过此函数传递控件,稍后再返回 - API call is taking too long to respond. How can I pass the control from this function and come back again later 使用Python发送数据包时,我的世界花了太长时间才能登录错误 - Minecraft took too long to log in error when sending packets with Python 识别网站是否花费太长时间进行响应 - Identify if a website is taking too long to respond 我的程序花了太长时间才能响应 - My program takes too long to respond 当我调用以下 django api 代码将文件上传到 Azure Blob 存储时,“使用 &#39;idna&#39; 编解码器编码失败(UnicodeError:标签太长)” - "encoding with 'idna' codec failed (UnicodeError: label too long)" when I call the following django api code to upload a file to Azure Blob Storage 如何为Google App Engine创建.py文件? - How to create a .py file for Google App Engine? Google App Engine-任务队列花费的时间太长,无法启动随机任务 - Google App Engine - Task Queue taking too long to start random tasks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM