Skip to content

Commit

Permalink
Fix Python 2.x Socket Error Broken Pipe:
Browse files Browse the repository at this point in the history
Fix if the connection is closed early by remote client.

Long history pallets/werkzeug#954

Close issues #97, #179 also mentioned in #168
  • Loading branch information
roramirez committed Apr 10, 2019
1 parent d47b018 commit 056a87c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qpanel/app.py
Expand Up @@ -410,6 +410,16 @@ def main():
print("Error: There not connection to Redis")
print(" Reset stats will not work\n")

if PY2:
# This change is a fix for issue with Python 2.7
# The error is IOError: [Errno 32] Broken pipe
# All this shit happend if the connection is closed early
# by remove client (browser)
# Long story https://github.com/pallets/werkzeug/issues/954
from gevent.wsgi import WSGIServer
http_server = WSGIServer((cfg.host_bind, cfg.port_bind), app)
http_server.serve_forever()

if cfg.base_url == '/':
app.run(host=cfg.host_bind, port=cfg.port_bind, use_reloader=reloader,
extra_files=[cfg.path_config_file])
Expand Down
1 change: 1 addition & 0 deletions requirements/base.txt
Expand Up @@ -10,3 +10,4 @@ future
rq-scheduler>=0.6.1,<0.7.0
python-ESL==1.4.18
git+git://github.com/maxcountryman/flask-themes@9eac2dc#egg=Flask-Themes
gevent==1.1.2

0 comments on commit 056a87c

Please sign in to comment.