Repository navigation
sqlite3: some code paths ignore exceptions #108083
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixes
on Aug 17, 2023 I have not found a test for failing
Connection.close(). Would it be possible to write one? Maybe in a separate issue.I have not found a test for failing
Connection.close(). Would it be possible to write one? Maybe in a separate issue.It should be possible to force the implicit ROLLBACK in
.close()to fail using some kind of database lock trick. Perhaps we could use a similar trick as intest_ctx_mgr_rollback_if_commit_failed.- added a commit that references this issue
on Aug 19, 2023 Keeping this open until tests are added.
sqlite3_close()can be made failing in many ways, butsqlite3_close_v2()tries hard to return SQLITE_OK, so it may be not so easy to provoke a failure.Yes,
sqlite3_close_v2()returnsSQLITE_OKif it is given a valid database handle.
sqlite3_closecan return an error, but it is hard to see how to be able to trigger that from the constructor; I'm not sure it is possible. We could just as well usesqlite3_close_v2()in the constructor.If closing a connection can fail but the
sqlite3_close_v2()ignores errors, is there another API to "flush" a connection and reports errors?If there is no easy way to trigger an error at exit or to report it, I suggest to just give up and close the issue.
If there is no easy way to trigger an error at exit or to report it, I suggest to just give up and close the issue.
I don't think there is; the case is the constructor, between the
sqlite3_open_v2call and the following fourgoto errorjumps. I don't see how we can provoke an error there.Closing this as resolved.
Thanks, nice sqlite3 enhancement! Ignoring exceptions silently is never a good idea.
Originally posted by @vstinner in #108015 (comment):
Linked PRs