I write a very simple flask server. This server response to GET
and give back my home.html.
I visit the site on 127.0.0.1:5000
everything is good till now.
However, if I keep pressing "fresh" (Command+R on my computer) a lot of times for a few second, as fast as I can, then, my flask give this error and breaks down.
Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in bootstrap_inner self.run() File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/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/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 238, in serve_forever self._handle_request_noblock() File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock self.handle_error(request, client_address) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 655, 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/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/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 152, in write self.send_header(key, value) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 401, in send_header self.wfile.write("%s: %s\r\n" % (keyword, value)) IOError: [Errno 32] Broken pipe
I believe this is what happened: When my server was trying to transmit html to my browser, I pressed the refresh and broke the pipe. So my server got confused and then give error.
How to solve this problem? Or this site is not usable as all since anyone who ask constantly for my page can break my webpage down.
Thanks!