2012-02-08 6 views
1

docs(下)にある同じサンプルを使用してblobstoreに書き込もうとすると、毎回devサーバーで動作しますがappspotでこのエラーが発生して100%時間が掛かります:The API call file.Create() took too long to respond and was cancelled.グーグルではこれはまれな問題ですが、報告されているものもあります。ここで何が起こっているか考えてみましょうか?App Engine:API呼び出しfile.Create()が応答に時間がかかってキャンセルされました

私はdevのサーバでPython 2.6を使用しているので、おそらく私はdevの間にこれを見ていないでしょう。

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) 

トレースバック:

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 
+0

アプリケーションIDは何ですか?プロダクションで鉛を再現するURLを共有できますか? – proppy

+0

同じ問題があり、散発的です。私のappidはyagruma-site – bustrofedon

答えて

1

それは公式マニュアルに文書化されていません。ファイルを開くときにexclusive_lock=Trueを追加してみてください。 M/SからHRDへのブロブストアの移行中に、私はこの問題を抱えていたと思います。

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') 
+0

はいです!マイグレーション後にもこの問題にぶつかりました。あなたのヒントは私に多くの時間を節約しました。 –

関連する問題