Python-Flask No response: After stayed active for one day

Tags: , ,

App description: I am using Python-Flask module with PostgreSql 12 as a REST API on a Web based application. There is a lot of request based heartbeat (JavaScript SetIntervals to send heartbeat almost for a every second and the CRUD operations for every user request on a small scale) and REST data (json data with responsed jsonify library of flask) consuming on client-side of application

Linode Linux Hosting, Ubuntu 18.04 LTS, Python3 (3.6.9), Flask(1.1.2)

Important code notes & quotes:
This is the schema of the app:

-/app | The part which is assembly of other py components(, and calling config properties   | The file contains Client routes   | Where the error routes written   | The file contains database Columns and Python objects    | The main backend file of whole app  
--/templates    | Config    | Manage file to database migrations

And the

from app import app

if __name__ == "__main__":"", debug=True, port=3000, ssl_context=('cert.crt', 'key.key'),threaded=True)

Problem: Flask get stunned approximately after one day, Takes no requests and return no responses (Chrome returns: It took too long to get response)

Dependencies (If it is possible): Staying with the pure HTTP methods for data and heartbeat transportation; instead of websockets or other transportation protocols

Questions: What could cause this problem? How can i fix this?


Flask doc recommends not to use the development server when deploying to production. It is intended for use only during local development. It is not designed to be particularly efficient, stable, or secure.

You can use the uwsgi server to serve the flask app in development mode. uWSGI runs multiple processes for your web application. So loads are mitigated in different threads and incoming other requests are accepted by uWSGI.

Source: stackoverflow