Closed
Description
Migrated issue, originally created by Michael Bayer (@zzzeek)
it's very tough to figure out how to reproduce this one. If you get a non-disconnect exception, but an unclosable cursor within first connect, the exception is squashed because we have a DBAPI connection in first_connect, not a connection fairy.
def _safe_close_cursor(self, cursor):
"""Close the given cursor, catching exceptions
and turning into log warnings.
"""
try:
cursor.close()
except (SystemExit, KeyboardInterrupt):
raise
except Exception:
self.connection._logger.error(
"Error closing cursor", exc_info=True)
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
sqlalchemy-bot commentedon May 30, 2014
Michael Bayer (@zzzeek) wrote:
occurs when the engine first connects and does its initial checks,
and the exception is not a disconnect exception, yet the cursor
raises an error when we try to close it. In this case the real
exception would be quashed as we tried to log the cursor close
exception via the connection pool and failed, as we were trying
to access the pool's logger in a way that is inappropriate
in this very specific scenario. fixes engine/base -> safe_close_cursor assumes our connection has a _logger #3063
→ 814637e
sqlalchemy-bot commentedon May 30, 2014
Michael Bayer (@zzzeek) wrote:
occurs when the engine first connects and does its initial checks,
and the exception is not a disconnect exception, yet the cursor
raises an error when we try to close it. In this case the real
exception would be quashed as we tried to log the cursor close
exception via the connection pool and failed, as we were trying
to access the pool's logger in a way that is inappropriate
in this very specific scenario. fixes engine/base -> safe_close_cursor assumes our connection has a _logger #3063
→ 758dc17
sqlalchemy-bot commentedon May 30, 2014
Changes by Michael Bayer (@zzzeek):