4

I've run into a situation where an API built on Flask-Restul intermittently becomes non-responsive. Currently it's running from Werkzeug (which I'm aware is for non-production use only) and single threaded. To complicate things a little further this is also all wrapped up inside axscript within another application.

When non-responsive, a significant number of sockets show in the CLOSE_WAIT so there's something not being handled correctly during a client initiated socket teardown.

As this is running single threaded it appears that the internals of a request handler may be blocking indefinitely preventing other requests from being accepted and ultimately causing the client timeout. However, as the thread is busy this prevents the socket from actually closing.

Does this sounds like a sane assumption based on knowledge other have of the framework? Also, if an unhanded exception is thrown within a request handler, will this always result in a 500 error being returned, or is there some other scenario here I'm missing?

Kim Burgess
  • 467
  • 3
  • 15
  • 1
    I am running into the same issue. Did you happen to find the fix?https://stackoverflow.com/questions/34249356/flask-api-not-receiving-requests-all-of-a-sudden – 90abyss Dec 13 '15 at 08:44
  • 1
    @90abyss I ended up switching it over to Tornado, which was a trivial process and also provided a significant performance boost. Details here: http://flask.pocoo.org/docs/0.10/deploying/wsgi-standalone/#tornado. No issues since. – Kim Burgess Dec 13 '15 at 09:08
  • 1
    Thanks so much! Tornado seems to have fixed the issue. – 90abyss Dec 13 '15 at 18:03

0 Answers0