Bug #79903 Memory Leak on escape_string()
Submitted: 9 Jan 2016 21:21 Modified: 28 Jul 2017 2:39
Reporter: Mykola Ulianytskyi Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S1 (Critical)
Version:2.1.3 OS:CentOS (7.2)
Assigned to: CPU Architecture:Any

[9 Jan 2016 21:21] Mykola Ulianytskyi
Description:
Memory Leak on escape_string():

---------------------------------------------
import _mysql_connector

cnx = _mysql_connector.MySQL()

cnx.connect(
	host        = '127.0.0.1',
	database    = 'test',
	user        = 'test',
	password    = 'test',
)

for i in range(10000000):
	cnx.escape_string(str(i))

---------------------------------------------
while sleep 1; do 
	ps aux | egrep [t]est | awk '{ print $5"\t"$6 }'; 
done

---------------------------------------------
VSZ     RSS
179364	11884
196772	29308
213924	46468
231076	63628
248228	80788
265380	97948
282788	115108
299684	132268
316836	149428
333476	166060
350628	183220
367780	200380
384932	217540
402084	234436
418980	251332
435364	267964
452516	284860
469412	302020
486308	318652
502948	335548
520100	352444
536996	369604
554148	386764
571300	403924

Please fix.

Thank you

--
With best regards,
Mykola

How to repeat:
+
[9 Jan 2016 21:23] Mykola Ulianytskyi
CentOS: 7.2 x86_64
MySQL: 5.7.10
MySQL Connector: 2.1.3
Python 3.5.1
[23 Feb 2016 11:29] Chiranjeevi Battula
Hello  Mykola Ulianytskyi,

Thank you for the bug report and test case.
Verified this behavior on MySQL Connector/Python 2.1.3.

Thanks,
Chiranjeevi.
[28 Jul 2017 2:39] Paul DuBois
Posted by developer:
 
Fixed in 2.1.7.

The escape_string() method leaked memory.