From 3aa5553e1c03e9dbff919953f4429da73ee3154e Mon Sep 17 00:00:00 2001 From: Philip Neustrom Date: Tue, 8 Dec 2015 01:32:44 -0800 Subject: [PATCH] Use multithreaded mode for flask. Multi-threaded mode should be used here, even for this very simple app. Otherwise, if someone tests this container on e.g. AWS ECS or AWS EB with an ELB, they will see the ELB health check keep-alive request consume the only request thread, which will cause the container to be killed repeatedly and the user to be deeply confused. I lost many hours trying to debug this, figuring it was a problem with how I had ECS/EB set up, but it was actually a nit in this example flask app. --- webapp/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/app.py b/webapp/app.py index 1bca36aa..20221c8a 100644 --- a/webapp/app.py +++ b/webapp/app.py @@ -12,4 +12,4 @@ def hello(): if __name__ == '__main__': # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000)) - app.run(host='0.0.0.0', port=port) + app.run(host='0.0.0.0', port=port, threaded=True)