[CONPY-274] Crash in garbage collector Created: 2023-11-27  Updated: 2023-12-01  Resolved: 2023-12-01

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 1.1.8
Fix Version/s: 1.1.9

Type: Bug Priority: Major
Reporter: Georg Richter Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

OS: Windows 11


Python Version: 3.8+

 Description   

When running a script without closing connection and cursor python sometimes crashes when closing these objects via garbage collector (Only reproducable on Windows).

Instead of if tp_dealloc method, objects should be cleared in tp_finalize.

import mariadb
 
c=mariadb.connect(user="root", db="test")
cursor=c.cursor()
cursor.execute("select * from t1")

$ python test.py
Windows fatal exception: access violation
 
Current thread 0x00004c88 (most recent call first):
  <no Python frame>


Generated at Thu Feb 08 03:31:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.