Flask app get "IOError: [Errno 32] Broken pipe"
<p>Now I use flask to develop web app.</p>

<p>But at first it works well,after operating web page for a while,the flask back-end shows error like these:</p>

<pre><code>   File "/usr/lib64/python2.6/BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 251, in handle_one_request
    return self.run_wsgi()
  File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 184, in execute
    write(data)
  File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 152, in write
    self.send_header(key, value)
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 390, in send_header
    self.wfile.write("%s: %s\r\n" % (keyword, value))
IOError: [Errno 32] Broken pipe
</code></pre>

<p>My app run on port 5000 <code>app.run(debug=True,port=5000)</code>,</p>

<p>I use nginx as web server,and set <code>proxy_pass http://127.0.0.1:5000</code> in nginx config file.</p>

<p>Now I really don't know where is the wrong,I use <code>session['email'] = request.form['email']</code> and in other file I use <code>email = session.get('email')</code>.</p>

<p>Is this usage right? How to set session active period?</p>

<p>or any other reason cause this error ?</p>

<p>then I set <code>app.run(debug=False,port=5000)</code>,it shows new error</p>

<pre><code>File "/usr/lib64/python2.6/SocketServer.py", line 671, in finish
    self.wfile.flush()
  File "/usr/lib64/python2.6/socket.py", line 303, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
socket.error: [Errno 32] Broken pipe
</code></pre>

<p>why ?</p>

<p>Please help me,thks.</p>