chevron-up bell reply instagram twitter2 feed3 finder search-25px-p0

Flask WSGI server error: code 400, message Bad request version (‘\xefg#\x00&\xc0,\xc0+\xc0$\xc0#\xc0’)

2017-06-13

When I went to office this morning, I was told one of company's website is not running properly. To be more specific, the whole web will be frozen every time 10 mins after a restart. The web was developed by myself and it was using Flask, with a SSL certificate in it.

As a first glance of the log:

I thought it might be a SSL certificate issue, which might not be configured correctly. As I simply deploy the code from git server, and not regenerate the SSL keys. After redo the key, the web is still the same. This time, I found a lot of TCP connections "Close Wait":

As we known, when a TCP connection is in "Close Wait" status, which means this connection is not fully released, and waiting for a close by the web server. So I go to the Flask server setting file.

Wait, a web server must be multi-threading, instead of waiting for a single thread to do all the jobs, so when I add threaded=True and restart the web server, the issue disappeared.

arkilis

Comments: