[CONPY-195] Memory leak - using cursor function - fetchone Created: 2022-03-20  Updated: 2022-05-03  Resolved: 2022-04-12

Status: Closed
Project: MariaDB Connector/Python
Component/s: None
Affects Version/s: 1.0.7
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: suresh ramagiri Assignee: Georg Richter
Resolution: Incomplete Votes: 0
Labels: None

Attachments: File memleak.py    
Issue Links:
Relates
relates to CONPY-196 Missing decrement of reference pointe... Closed

 Description   

It is reported by one of our customers, using the cursor functions: fetchone, observing the memory consumption and slowly leading to high memory usage, possible some sort of memory leak.

Customer comments:
Python version is - Python 3.6..
Find attached small program we stripped out using the MariaDB library. The program almost double in size in ~ 48hrs and still growing.
The pattern of growth is around 200K per hour. After the initial growth, it stays on the same size for 20-30min, then jump up by 90-100KB



 Comments   
Comment by suresh ramagiri [ 2022-03-28 ]

Locally am able to reproduce the case:

MariaDB Connector/Python 1.0.7/1.0.10
Python Version 3.6/3.8

With the sample program shared, it does look like over a time, it consumes the memory.

Python3.6

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
31980 root 20 0 181828 17808 4672 S 0.3 0.0 0:16.06 python3
...
31980 root 20 0 192080 27972 4672 S 0.0 0.1 0:37.22 python3 (executing from more than 4 days )

Python3.8

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
32083 root 20 0 173416 8604 4788 S 0.0 0.9 0:00.03 python3.8
...
...
32083 root 20 0 180020 15292 4884 S 0.0 1.5 0:15.72 python3.8 (executing from more than 24hrs)

Note:
The sample program contains only once the cursor function fetchone is being used. But it is noted by the customer, deployed code include several of these function calls which makes memory usage to grow much faster.

Comment by Julien Fritsch [ 2022-03-28 ]

Thank you.

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