This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients erlendaasland, ghaering, scorp, serhiy.storchaka
Date 2021-10-18.11:40:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634557257.84.0.82194400621.issue26387@roundup.psfhosted.org>
In-reply-to
Content
FYI: We've been using sqlite3_close_v2(), when available, since 2017 (see 86a670543ff97d52fd9b8ca0477f8b6d27ee946d), but we now call it with GIL held.

I'm leaning towards closing this as out-of-date. There is no reproducer, there has been no more similar bug reports, and there has been no activity on this issue.


Possible improvement of connection_close():
  1. save database pointer to temporary variable
  2. clear self->db
  3. call sqlite3_close_v2() (without holding GIL)

diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index d6d1fa8bf2..47c0267e89 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -301,9 +301,12 @@ static void
 connection_close(pysqlite_Connection *self)
 {
     if (self->db) {
-        int rc = sqlite3_close_v2(self->db);
-        assert(rc == SQLITE_OK), (void)rc;
+        sqlite *db = self->db;
         self->db = NULL;
+        Py_BEGIN_ALLOW_THREADS
+        int rc = sqlite3_close_v2(db);
+        assert(rc == SQLITE_OK), (void)rc;
+        Py_END_ALLOW_THREADS
     }
 }
 }
History
Date User Action Args
2021-10-18 11:40:57erlendaaslandsetrecipients: + erlendaasland, ghaering, serhiy.storchaka, scorp
2021-10-18 11:40:57erlendaaslandsetmessageid: <1634557257.84.0.82194400621.issue26387@roundup.psfhosted.org>
2021-10-18 11:40:57erlendaaslandlinkissue26387 messages
2021-10-18 11:40:57erlendaaslandcreate