Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Not a Bug
-
1.1.8
-
Rocky8 x86_64
-
3
Description
When called as follows, the mariadb-1.1.8 connector has a memory lead due to leaking connection and cursor objects:
with mariadb.Connection( host='localhost', user='root', password=db_pass, unix_socket=db_sock, connect_timeout=5 ) as db_conn: |
my_cur = db_conn.cursor() |
...
|
except mariadb.Error as ex: |
print(str(ex)) |
Apparently the mariadb.Connection class does not handle (or properly) handle the special _enter_ and _exit_ methods to handle entry and exit from with statements.
Attachments:
memleak-with.py can be run (modify the db_pass to root password) to show the memory growth
memleak-withfix.py contains a wrapper class which implements the _enter_ and _exit_ methods to close the connection and cursor, which does NOT have a memory leak.