| Bug #8933 | Memory leak when making a large number of connections | ||
|---|---|---|---|
| Submitted: | 3 Mar 2005 22:25 | Modified: | 7 May 2005 15:07 |
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 4.1.6-gamma-standard | OS: | Linux (Fedora Core 2 (2.6.9-1.6_FC2)) |
| Assigned to: | CPU Architecture: | Any | |
[12 Apr 2005 19:41]
Bruno Dingfelder
I have an application in PHP that also requires a large number of connections, and after a few days my server performance will drop fast. When I check the mysql server process I also noticed it grows: @ 12:51 Pm RES = 6940, % MEM = 2.8 @ 12:58 Pm RES = 7628, % MEM = 3.1 I am running Default Mysql Php Rpms in Fedora Core 2

Description: The process size of the mysql processes appears to grow slowly if applications rapidly connect and disconnect from the database. In a long running server (90+ days), this problem eventually caused the mysql processes to become so large as to impact performance. Restarting the mysql server resolves the issue, but that shouldn't be necessary. How to repeat: If you execute the following perl script and do 'ps aux | grep mysql' every 5-10 minutes on the database host, you can watch the size (RSS) of the mysql processes grow slowly. #!/usr/bin/perl use DBI; my $i; for ($i=0; $i<50000; $i++) { my $mysql_dbh = DBI->connect("DBI:mysql:database=some_database;host=some_host", "user", "the user's password", {RaiseError => 1, AutoCommit => 1}); $mysql_dbh->disconnect(); print "$i...\n" if ($i % 100 == 0); } Suggested fix: Run a version of mysql with a memory leak detector compiled in to see if the leak can be easily munched.