Closed Fred-si closed 7 months ago
First, could you please provide information about: firebird-driver version, Python version and Firebird version?
Second, the error happens in __del__
destructor. This is always very tricky to debug as the condition when this code is executed is not deterministic (hence it's not easy if even possible to create reliable reproducible test case). The general recommendation is to always close resources such as Connection explicitly (or use it as context manager) to avoid situations when object is released by memory manager.
But in this case, it could be something more subtle, as the culprit seems to be the broken interface reference counting (which couldn't happen in normal circumstances).
Hello
project run on python 3.11, firebird-driver is in 1.10.0 and SQLAlchemy in version 2.0.22, the project use also sqlalchemy-firebird in version 2.0.2. Firebird server is jacobalberty/firebird:v4.0.2 docker image. Firebird client lib can be in 4.0.2 when project run in docker or 3.08 when used in venv (provided by ubuntu firebird package).
firebird-driver v1.8.0 does not seem to be affected, but I’m not sure.
firebird-driver v1.9.0 and v1.8.0 are also affected
I see. I think that problem could come from use of 3.0.8 Firebird client library to access the v4.0.2 server.
Sure, this should be still considered as bug (although probably not in firebird-driver, I don't see how driver could be a culprit here), as this shouldn't happen even if older client is used to access newer server. But these cross-version scenarios are not part of testing (neither Firebird QA or firebird-driver), so it's possible that some backward compatibility issues could get unnoticed.
Could you please verify whether this issue goes away with 4.0.2 client lib vs. 4.0.2 server?
No, issue still occurs when using 4.0.2 client lib with 4.0.2 server.
Interesting. What really puzzles me is that it fails in deprecatedDetach
i.e. detach
in IAttachment version 3. This interface was changed to version 4 and then to 5 where detach
and dropDatabase
are redefined (hence the old detach
become deprecatedDetach
). This change to new interface version happened in 3.0.7 => 3.0.8, 4.0.0 => 4.0.1, so neither your version 4.0.2 or 3.0.8 should use this old interface version.
Anyway, the Connection.__del__
is a tricky part, so your proposed fix is good as any other, so I'll adopt it.
Ok, thanks a lot for your help :pray:
Hello. I work on project that use SQLAlchemy+firebird. We have recently migrate from fdb to firebird-driver python package and we experience some python crashes with SIGABRT in our test suite.
These crashes happen after introduce little modification on code/test that seem to have no relation with test that crash. Sometime, the modified code is not executed before crash. Crashes can happen at different places in tests suite, during a database operation or not, but always at the place will code not change. They can happen in Gitlab runner or locally in venv.
The common points on all crashes is that happen on
detach
method ofiAttachment_v3
oninterface.py
.Adding if condition before
vtable.deprecatedDetach
seems to solve the problem, but I have no experience on database driver development, I don't know if it’s good idea.Someone might be able to help us solve this problem properly?