You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2021-03-20 15:00:02,704 ERROR Exception on /salto/mek [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.9/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/srv/koseki/koseki/plugins/salto/salto.py", line 58, in salto_mek
self.storage.session.query(Person).filter_by(state="active").all()
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3373, in all
return list(self)
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3535, in __iter__
return self._execute_and_instances(context)
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3556, in _execute_and_instances
conn = self._get_bind_args(
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3571, in _get_bind_args
return fn(
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3550, in _connection_from_session
conn = self.session.connection(**kw)
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/session.py", line 1142, in connection
return self._connection_for_bind(
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/session.py", line 1150, in _connection_for_bind
return self.transaction._connection_for_bind(
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/session.py", line 409, in _connection_for_bind
self._assert_active()
File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/session.py", line 282, in _assert_active
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: This session is in 'prepared' state; no further SQL can be emitted within this transaction.
2021-03-20 15:00:05,877 INFO Job "MetricPlugin.calc_metric (trigger: cron[minute='0', second='0'], next run at: 2021-03-20 16:00:00 CET)" executed successfully```
The text was updated successfully, but these errors were encountered:
If a scheduled cron task is running at the exact same time a salto request comes in then the Database throws an error due to multi-thread access. Create one Session per thread instead, see: https://stackoverflow.com/questions/39126810/this-session-is-in-prepared-state-no-further-error-with-sqlalchemy-using-sc
The text was updated successfully, but these errors were encountered: