The `get_session` context manager is used for retrieving sqlalchemy database sessions. However it does not close the session after usage. This can lead to errors like 'sqlalchemy.exc.InvalidRequestError: This session is in 'prepared' state; no further SQL can be emitted within this transaction.'. SQLAlchemy tries to re-use a session that 'commit' was already called on which causes this error. This can be fixed by properly closing the session by calling session.close in the session_db:py:112 (get_session) context manager. Furthermore the current code uses `scoped_session` in DbRegistry.__create which is not correct. The `scoped_session` by default uses a thread local scope, meaning one session is created per thread. However that is not how tornado works which rather is single threaded using an event loop.
univention-management-console.yaml d9f9a3a2b9f3 | Bug #57680: Fix session handling in UMC and run perf tests with psql univention-management-console (12.0.35-8) d9f9a3a2b9f3 | Bug #57680: Fix session handling in UMC and run perf tests with psql Successful build Package: univention-management-console Version: 12.0.35-8 Branch: 5.0-0 Scope: errata5.0-9 Successful build Package: univention-management-console Version: 13.0.28 Branch: 5.1-0 Successful build Package: univention-management-console Version: 14.0.39 Branch: 5.2-0
OK - changes OK - yaml OK - 5.0-9, 5.1 and 5.2
<https://errata.software-univention.de/#/?erratum=5.0x1154>