在GAE上这行代码:
file_name = files.blobstore.create(mime_type ='image / png')
丢弃 google.appengine.runtime.DeadlineExceededError
以下是完整的方法代码:
class UploadsHandler(JSONRequestHandler):
def upload_blob(self, content, filename):
file_name = files.blobstore.create(mime_type='image/png')
file_str_list = split_len(content, 65520)
with files.open(file_name, 'a') as f:
for line in file_str_list:
f.write(line)
files.finalize(file_name)
return files.blobstore.get_blob_key(file_name)
记录消息以:
结束处理此请求的进程遇到严重问题,导致其退出。这可能会导致新进程用于您的应用程序的下一个请求。如果经常看到此消息,则可能会在应用程序初始化期间抛出异常。 (错误代码104 )
完整错误堆栈:
<class 'google.appengine.runtime.DeadlineExceededError'>:
Traceback (most recent call last):
File "/base/data/home/apps/s~mockup-cloud/1.352909931378411668/main.py", line 389, in main
util.run_wsgi_app(application)
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 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~mockup-cloud/1.352909931378411668/main.py", line 339, in post
original_key = "%s" % self.upload_blob(src)
File "/base/data/home/apps/s~mockup-cloud/1.352909931378411668/main.py", line 268, in upload_blob
file_name = files.blobstore.create(mime_type='image/png')
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/blobstore.py", line 68, in create
return files._create(_BLOBSTORE_FILESYSTEM, params=params)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/file.py", line 487, in _create
_make_call('Create', request, response)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/files/file.py", line 228, in _make_call
rpc.wait()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 533, in wait
self.__rpc.Wait()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 119, in Wait
rpc_completed = self._WaitImpl()
File "/base/python_runtime/python_lib/versions/1/google/appengine/runtime/apiproxy.py", line 131, in _WaitImpl
rpc_completed = _apphosting_runtime___python__apiproxy.Wait(self)
在文件上传时创建Blob。该应用程序的其他方法工作得很好。看起来blobstore在30秒内没有响应。
为什么会这样? 谢谢!
答案 0 :(得分:0)
好像你不是唯一有这个问题的人:
http://groups.google.com/group/google-appengine/browse_thread/thread/27e52484946cbdc1#
(今天发布)
答案 1 :(得分:0)
似乎Google对其服务器进行了一些重新配置。现在一切都像以前一样正常。
答案 2 :(得分:0)
当您的请求处理程序执行时间过长时会发生runtime.DeadlineExceededError
- blobstore调用恰好是发生这种情况时正在运行的内容。你需要用appstats来描述你的处理程序,看看它为什么这么慢。