加载localhost时Django Nonrel中的管道错误

时间:2011-11-11 02:20:26

标签: python google-app-engine django-nonrel

运行Django Nonrel,使用Google App Engine 2.6.0和Python 2.7,我在尝试第一次加载localhost和localhost / admin时遇到此异常(我希望它会在任何页面上发生):

Exception happened during processing of request from ('127.0.0.1', 57011)
    Traceback (most recent call last):
      File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
        self.process_request(request, client_address)
      File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
        self.finish_request(request, client_address)
      File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 2438, in __init__
        BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
      File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
        self.finish()
      File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
        self.wfile.flush()
      File "/usr/lib/python2.7/socket.py", line 303, in flush
        self._sock.sendall(view[write_offset:write_offset+buffer_size])
    error: [Errno 32] Broken pipe

奇怪的是,它只能使用谷歌浏览器。使用Firefox时,它不会打印任何异常(或者至少,我在多次尝试后无法在Firefox中复制此问题)。

有没有人知道这个问题?

由于

1 个答案:

答案 0 :(得分:6)

Chrome和dev_appserver.py之间存在a few similar reports竞争条件问题。通常的情况是,Chrome会打开与服务器的多个并发连接,但首先会在第二个连接上发送请求。因为dev_appserver是单线程的,所以第一个请求会阻塞,服务器会挂起,直到有人放弃。

假设以--disable-preconnect启动Chrome可以防止出现这种情况。