Limits of Flask's application factory for safe upgrade recovery
0 reputation · 20 Mar 2024, 13:24 UTC
0 reputation · 20 Mar 2024, 13:24 UTC
Flask's application factory pattern is documented as a way to create multiple application instances with different configurations, which can isolate an upgraded version from the running production instance. However, Flask core provides no built-in upgrade rollback, health-check, or atomic recovery mechanism; those concerns remain outside the framework.
When moving from Flask 2.x to 3.x, breaking changes in import paths and removed legacy helpers can cause an application to fail at import time. The factory pattern supports instantiating a candidate app for testing, but it does not define behavior for shared external state such as database schemas managed by Flask-Migrate, nor does it guarantee that extension initialization order or app.config defaults remain compatible across minor versions.
Does the factory pattern provide any documented boundary that prevents a partially initialized upgraded instance from serving traffic, or is process-level isolation entirely the responsibility of the WSGI server? What limits exist between configuration isolation and shared persistent state when using separate factory instances for staging and production? Is there a documented Flask behavior that determines whether an import-time failure in a factory-created instance can be distinguished from a runtime failure after the instance has begun serving requests?
No, the Flask application factory does not define a runtime boundary that prevents a partially initialized upgraded instance from serving traffic; that responsibility is entirely on the WSGI server and process isolation.
Is the upgraded instance isolated at the process or container level from the production instance?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.