SDK のバージョン 1.9.9 を使用していますが、devserver に問題があります。1 つのインスタンスを持つ手動でスケーリングされたモジュールがあります。を作成しwebapp2.RequestHandler
ました/_ah/start
。そのハンドラーで、バックグラウンド スレッドを開始します。開発サーバーでアプリを実行すると、_ah/start
ハンドラーは 200 を返しますが/_ah/background
、しばらくの間ランダムに 500 エラーを返します。しばらくすると (通常は 1 ~ 2 分、場合によってはそれ以上)、500 エラーは停止しますが、数時間ごとにランダムに再び発生します。また、新しいブラウザー タブ (Chrome) を開くたびに、同じエラーが発生するようです。誰がこれを引き起こしているのか知っていますか?
は次のとおりRequestHandler
です。/_ah/start
class StartupHandler(webapp2.RequestHandler):
def get(self):
runtime.set_shutdown_hook(shutdown_hook)
global foo
if foo is None:
foo = Foo()
background_thread.start_new_background_thread(do_foo, [])
self.response.http_status_message(200)
500エラーは次のとおりです。
ERROR 2014-08-18 07:39:36,256 module.py:717] Request to '/_ah/background' failed
Traceback (most recent call last):
File "\appengine\tools\devappserver2\module.py", line 694, in _handle_request
environ, wrapped_start_response)
File "\appengine\tools\devappserver2\request_rewriter.py", line 311, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "\appengine\tools\devappserver2\module.py", line 1672, in _handle_script_request
request_type)
File "\appengine\tools\devappserver2\module.py", line 1624, in _handle_instance_request
request_id, request_type)
File "\appengine\tools\devappserver2\instance.py", line 382, in handle
request_type))
File "\appengine\tools\devappserver2\http_proxy.py", line 190, in handle
response = connection.getresponse()
File "E:\Programing\Python27\lib\httplib.py", line 1030, in getresponse
response.begin()
File "E:\Programing\Python27\lib\httplib.py", line 407, in begin
version, status, reason = self._read_status()
File "E:\Programing\Python27\lib\httplib.py", line 365, in _read_status
line = self.fp.readline()
File "E:\Programing\Python27\lib\socket.py", line 430, in readline
data = recv(1)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
INFO 2014-08-18 07:39:36,257 module.py:1890] Waiting for instances to restart
INFO 2014-08-18 07:39:36,262 module.py:642] lease: "GET /_ah/background HTTP/1.1" 500 -