title: Flask - socket.error: [Errno 10053] An established connection was aborted by the software in your host machine
body: <p>Re-opening this question upon request (<a href="https://stackoverflow.com/questions/17854713/error-errno-10053">error: [Errno 10053]</a>), providing the minimal testable example:</p>
  
  <pre><code>import time
  from flask import Flask, render_template
  app = Flask(__name__, static_folder='static', template_folder='templates')
  
  @app.route('/')
  def main():
      return render_template('test.html')
  
  @app.route('/test')
  def test():
      print "Sleeping. Hit Stop button in browser now"
      time.sleep(10)
      print "Woke up. You should see a stack trace from the problematic exception below."
      return render_template('test.html')
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;a href="/test"&gt;test&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Guide:
  Run the app, navigate to localhost:port, click on the link, then hit Stop button in your browser. You should see the exception once the sleep finishes.
  The sleep is necessary to simulate any sort of activity happening on the server. It could be just a few seconds: if user manages to navigate away from the page - Flask will crash.</p>
  
  <blockquote>
    <p>socket.error: [Errno 10053] An established connection was aborted by
    the software in your host machine</p>
  </blockquote>
  
  <p>Why does the server stop serving the application? What other server can I use for my Flask application to avoid this? </p>