nginx Errno 32:某些请求的管道破裂

2024-04-18 20:14:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个NGINX/flask/Docker服务器,使用: https://github.com/tiangolo/uwsgi-nginx-flask-docker 它适用于运行小而不频繁的请求。如果每次从amazon下载的数据量大的话(比如说从amazon下载的数据量大的话,可以尝试一次)。我得到这个错误:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 659, in inner
    srv.serve_forever()
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 499, in serve_forever
    HTTPServer.serve_forever(self)
  File "/usr/local/lib/python2.7/SocketServer.py", line 233, in serve_forever
    self._handle_request_noblock()
  File "/usr/local/lib/python2.7/SocketServer.py", line 292, in _handle_request_noblock
    self.handle_error(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.7/SocketServer.py", line 652, in __init__
    self.handle()
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 216, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 251, in handle_one_request
    return self.run_wsgi()
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 193, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 184, in execute
    write(data)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in write
    self.wfile.write(data)
IOError: [Errno 32] Broken pipe

我已经尝试向nginx/wsgi添加更多的进程和线程。我的uwsgi.ini文件看起来是这样的:

^{pr2}$

还有我的nginx.conf公司看起来像这样:

server {
    location / {
        try_files $uri @app;
    }
    location @app {
        include uwsgi_params;
        uwsgi_pass unix:///tmp/uwsgi.sock;
    }
    location /static {
        alias /app/static;
    }
}

有人知道是什么引起的吗?在


Tags: inpyselfrequestlibpackagesusrlocal