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
When a connection is lost, for example as a result of a server shutdown, after several attempts to execute statements, we cannot delete the Connection object.
Reproduced with an uncommitted cursor transaction.
from firebird.driver import connect
import os
con = connect('localhost:employee', user='sysdba', password='masterkey')
cur = con.cursor()
cur.execute("select 1 from rdb$database")
os.system('pkill firebird')
con.execute_immediate("insert into test values(1)")
con.execute_immediate("insert into test values(1)")
try:
con.close()
except Exception:
pass
exit()
The object is not deleted and on exit we get an exception to delete the cursor and statement:
Exception ignored in: <function Cursor.__del__ at 0x716f1160f2e0>
Traceback (most recent call last):
File "env/lib/python3.12/site-packages/firebird/driver/core.py", line 3047, in __del__
File "env/lib/python3.12/site-packages/firebird/driver/core.py", line 3791, in close
File "env/lib/python3.12/site-packages/firebird/driver/core.py", line 2736, in free
File "env/lib/python3.12/site-packages/firebird/driver/interfaces.py", line 832, in free
File "env/lib/python3.12/site-packages/firebird/driver/interfaces.py", line 113, in _check
firebird.driver.types.DatabaseError: connection shutdown
Exception ignored in: <function Statement.__del__ at 0x716f1160d940>
Traceback (most recent call last):
File "env/lib/python3.12/site-packages/firebird/driver/core.py", line 2712, in __del__
File "env/lib/python3.12/site-packages/firebird/driver/core.py", line 2736, in free
File "env/lib/python3.12/site-packages/firebird/driver/interfaces.py", line 832, in free
File "env/lib/python3.12/site-packages/firebird/driver/interfaces.py", line 113, in _check
firebird.driver.types.DatabaseError: connection shutdown
The text was updated successfully, but these errors were encountered:
What do you mean you cannot delete the Connection object? It's in fact deleted just fine, as the stack trace confirms. The exception is reported for __del__ finalizer, which was called when connection went out of scope (so it never reached the con.close() otherwise it would be reported from there). Also note that this exception is ignored, just reported as it doesn't does not mean anything.
When a connection is lost, for example as a result of a server shutdown, after several attempts to execute statements, we cannot delete the Connection object.
Reproduced with an uncommitted cursor transaction.
The object is not deleted and on exit we get an exception to delete the cursor and statement:
The text was updated successfully, but these errors were encountered: