We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redsah returns HTTP 500 after PostgreSQL connection was closed, e. g. if PostgreSQL was restarted.
It is easy to fix this issue by using pre-ping in SQLAlchemy
diff --git redash/settings/__init__.py redash/settings/__init__.py index efb2a1cd..8e00fc9f 100644 --- redash/settings/__init__.py +++ redash/settings/__init__.py @@ -29,6 +29,10 @@ SQLALCHEMY_DATABASE_URI = os.environ.get("REDASH_DATABASE_URL", os.environ.get(' SQLALCHEMY_MAX_OVERFLOW = int_or_none(os.environ.get("SQLALCHEMY_MAX_OVERFLOW")) SQLALCHEMY_POOL_SIZE = int_or_none(os.environ.get("SQLALCHEMY_POOL_SIZE")) SQLALCHEMY_DISABLE_POOL = parse_boolean(os.environ.get("SQLALCHEMY_DISABLE_POOL", "false")) +SQLALCHEMY_ENGINE_OPTIONS = { + # https://docs.sqlalchemy.org/en/13/core/pooling.html#pool-disconnects + 'pool_pre_ping': True, +} SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_ECHO = False diff --git requirements.txt requirements.txt index b3b0d668..c56bd668 100644 --- requirements.txt +++ requirements.txt @@ -12,7 +12,7 @@ Flask-Login==0.4.0 Flask-OAuthLib==0.9.5 # pin this until https://github.com/lepture/flask-oauthlib/pull/388 is released requests-oauthlib>=0.6.2,<1.2.0 -Flask-SQLAlchemy==2.3.2 +Flask-SQLAlchemy==2.4.0 Flask-Migrate==2.0.1 flask-mail==0.9.1 flask-sslify==0.1.5
Flask-SQLAlchemy 2.4.0 deprecated a few settings - they should be moved to SQLALCHEMY_ENGINE_OPTIONS too.
SQLALCHEMY_ENGINE_OPTIONS
The text was updated successfully, but these errors were encountered:
If you were to run a new request after this, will it error again?
Sorry, something went wrong.
No, this errors happens only on a first request (or a few first requests) after database connection was closed. Then redash reconnects to PostgreSQL.
No branches or pull requests
Issue Summary
Redsah returns HTTP 500 after PostgreSQL connection was closed, e. g. if PostgreSQL was restarted.
Steps to Reproduce
Technical details:
It is easy to fix this issue by using pre-ping in SQLAlchemy
Flask-SQLAlchemy 2.4.0 deprecated a few settings - they should be moved to
SQLALCHEMY_ENGINE_OPTIONS
too.The text was updated successfully, but these errors were encountered: