Bug #60531 DBD::mysql memory leak on connection error
Submitted: 18 Mar 2011 13:59 Modified: 15 Feb 2013 17:10
Reporter: Yuriy iLesik Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S2 (Serious)
Version:4.018 OS:FreeBSD (8.2 release)
Assigned to: CPU Architecture:Any
Tags: dbi, DDBD::mysql, memory leak

[18 Mar 2011 13:59] Yuriy iLesik
Description:
Memory leak using DBD::mysql on connection errors.

p5-DBD-mysql51-4.018
p5-DBI-1.616
Mysql Server version: 5.1.55 FreeBSD port: mysql-server-5.1.55

How to repeat:
This simple script shows the problem

use DBI;
use DBD::mysql;

for (1..10) {
    
    for (0..100) {
        my $con = DBI->connect('DBI:mysql:database=test;host=127.0.0.1', 'root', 'valid_pwd', {PrintError => 0,PrintWarn=>0});
        undef $con;
    };

    print `ps aux | grep perl | grep -v grep`;
};

root     66081  0.0  0.0 19512  6240  18  S+J   3:56PM   0:00.07 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.09 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.12 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.15 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.17 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.20 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.23 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.26 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.28 perl ./chat_server.pl
root     66081  0.0  0.0 19512  6244  18  S+J   3:56PM   0:00.31 perl ./chat_server.pl

RES: is constantly 6240

When using INVALID pwd (we get mysql auth error) result is 

root     66729  0.0  0.0 19512  6364  18  S+J   3:57PM   0:00.07 perl ./chat_server.pl
root     66729  0.0  0.0 19512  6496  18  S+J   3:57PM   0:00.09 perl ./chat_server.pl
root     66729  0.0  0.0 19512  6624  18  S+J   3:57PM   0:00.11 perl ./chat_server.pl
root     66729  0.0  0.0 19512  6752  18  S+J   3:57PM   0:00.13 perl ./chat_server.pl
root     66729  0.0  0.0 19512  6880  18  S+J   3:57PM   0:00.15 perl ./chat_server.pl
root     66729  0.0  0.0 19512  7008  18  S+J   3:57PM   0:00.18 perl ./chat_server.pl
root     66729  0.0  0.0 19512  7132  18  S+J   3:57PM   0:00.20 perl ./chat_server.pl
root     66729  0.0  0.0 21560  7284  18  S+J   3:57PM   0:00.22 perl ./chat_server.pl
root     66729  0.0  0.0 21560  7412  18  S+J   3:57PM   0:00.25 perl ./chat_server.pl
root     66729  0.0  0.0 21560  7540  18  S+J   3:57PM   0:00.27 perl 
./chat_server.pl

RES: is constantly GROWING.
[21 Mar 2011 18:51] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Feb 2013 17:10] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

I re-submitted your report to https://rt.cpan.org/Public/Bug/Display.html?id=83354
Please subscribe to the new report on CPAN and work with DBD::mysql developers in case if they need additional details.