Skip to content

Commit e69ff8c

Browse files
mvdbeekclaude
andcommitted
Fix connection leak in check_database_connection
Only check session.connection().invalidated when there's an existing transaction. This avoids checking out a new connection from the pool that would never be returned, causing "too many clients" errors during integration tests. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 5f458da commit e69ff8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/galaxy/model/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def check_database_connection(session):
6161
if isinstance(session, scoped_session):
6262
session = session()
6363
trans = session.get_transaction()
64-
if (trans and not trans.is_active) or session.connection().invalidated:
64+
if trans and (not trans.is_active or session.connection().invalidated):
6565
session.rollback()
6666
log.error("Database transaction rolled back due to inactive session transaction or invalid connection state.")
6767

0 commit comments

Comments
 (0)