Hi,
I am getting an intermittent error on my site. The details are below. It is usually fixed by refreshing the browser, but it is quite annoying. If anyone has any ideas please let me know.
Thanks, Martyn
Exception on / [GET] Traceback (most recent call last): File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1670, in _execute_context context = constructor( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 995, in _init_compiled self.cursor = self.create_cursor() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 1343, in create_cursor return self.create_default_cursor() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 1346, in create_default_cursor return self._dbapi_connection.cursor() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 982, in cursor return self.connection.cursor(args, *kwargs) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/mysql/connector/connection.py", line 809, in cursor raise errors.OperationalError("MySQL Connection not available.") mysql.connector.errors.OperationalError: MySQL Connection not available.
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask/app.py", line 2070, in wsgi_app response = self.full_dispatch_request() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask/app.py", line 1515, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask/app.py", line 1511, in full_dispatch_request rv = self.preprocess_request() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask/app.py", line 1857, in preprocess_request rv = self.ensure_sync(func)() File "/home/martynwheeler/wahoo-connect/wahoo_connect/home/views.py", line 22, in before_request if current_user.is_authenticated: File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/werkzeug/local.py", line 422, in get obj = instance._get_current_object() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/werkzeug/local.py", line 544, in _get_current_object return self.__local() # type: ignore File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask_login/utils.py", line 26, in <lambda> current_user = LocalProxy(lambda: _get_user()) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask_login/utils.py", line 346, in _get_user current_app.login_manager._load_user() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask_login/login_manager.py", line 329, in _load_user user = self._load_user_from_remember_cookie(cookie) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/flask_login/login_manager.py", line 372, in _load_user_from_remember_cookie user = self._user_callback(user_id) File "/home/martynwheeler/wahoo-connect/wahoo_connect/models.py", line 53, in load_user return User.query.get(int(id)) File "<string>", line 2, in get File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/util/deprecations.py", line 390, in warned return fn(args, kwargs) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 942, in get return self.get_impl(ident, loading.load_on_pk_identity) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 946, in _get_impl return self.session._get_impl( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2839, in _get_impl return db_load_fn( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/orm/loading.py", line 531, in load_on_pk_identity session.execute( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1689, in execute result = conn._execute_20(statement, params or {}, execution_options) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1582, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection return connection._execute_clauseelement( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1451, in _execute_clauseelement ret = self._execute_context( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1676, in _execute_context self._handle_dbapi_exception( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1994, in _handle_dbapi_exception util.raise( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_ raise exception File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1670, in _execute_context context = constructor( File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 995, in _init_compiled self.cursor = self.create_cursor() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 1343, in create_cursor return self.create_default_cursor() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 1346, in create_default_cursor return self._dbapi_connection.cursor() File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 982, in cursor return self.connection.cursor(args, **kwargs) File "/home/martynwheeler/.virtualenvs/venv39/lib/python3.9/site-packages/mysql/connector/connection.py", line 809, in cursor raise errors.OperationalError("MySQL Connection not available.") sqlalchemy.exc.OperationalError: (mysql.connector.errors.OperationalError) MySQL Connection not available. [SQL: SELECT user.id AS user_id, user.username AS user_username, user.email AS user_email, user.password_hash AS user_password_hash, user.forename AS user_forename, user.surname AS user_surname, user.about_me AS user_about_me, user.last_seen AS user_last_seen, user.confirmed AS user_confirmed FROM user WHERE user.id = %(pk_1)s] [parameters: [{'pk_1': 1}]] (Background on this error at: http://sqlalche.me/e/14/e3q8)