Bug #73232 | mysql.connector.django is leaking connections | ||
---|---|---|---|
Submitted: | 8 Jul 2014 13:29 | Modified: | 5 Sep 2014 13:41 |
Reporter: | Zemian Deng | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | Connector / Python | Severity: | S2 (Serious) |
Version: | 1.2.2 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Django |
[8 Jul 2014 13:29]
Zemian Deng
[8 Jul 2014 13:31]
Zemian Deng
FYI, I started a topic in forum, but no one replied. http://forums.mysql.com/read.php?50,616862,616862#msg-616862
[9 Jul 2014 12:40]
Zemian Deng
I have a patch here that can fix the leak (see Files attachement). The problem is the DatabaseOperations is using a instance of converter from an connection object. I cached the converter in the DatabaseWrapper and then immediately close the connection after the __init__(). Then later using this "cache" converter in DatabaseOperations. So far the converter doesn't seem to need a live connection to work. Let me know if you this works for you or not.
[9 Jul 2014 12:41]
Zemian Deng
Path file to fix conn leak for django
Attachment: myconnpy1.2.2_django_base.py.patch (application/octet-stream, text), 1.98 KiB.
[9 Jul 2014 12:43]
Zemian Deng
BTW, I am already an Oracle employee (zemian.deng@oracle.com), do you still need me to sign the Contributor Agreement form?
[5 Sep 2014 11:57]
Andrii Nikitin
Thank you for reporting this problem. I wasn't able to repeat it in 1.2.3 I created generic project using your link with Django 1.7 and see new connections are established in webserver console, but processlist shows the same amount of connections. I checked base.py and it looks really different - I will close with "Can't repeat" resolution, assuming the bug was fixed by some side changes.
[5 Sep 2014 13:41]
Zemian Deng
Hi Andrii, Yes I can confirmed that the latest connector 1.2.3 does not have this issue any more. But previous 1.2.2 is definitely repeatable (which is what I reported against with). Thanks for the update! Zemian