| Bug #13589 | Persistent connections stay open and accumulate | ||||
|---|---|---|---|---|---|
| Submitted: | 7 Oct 2001 5:33pm UTC | Modified: | 10 Jul 2002 9:27am UTC | ||
| From: | mtremblay at sitebrand dot com | Assigned to: | zak | ||
| Status: | Closed | Category: | MySQL related | ||
| Version: | 4.0.6 | OS: | RedHat 7.1 | ||
| Votes: | 4 | Avg. Score: | 4.2 ± 0.8 | Reproduced: | 3 of 3 (100.0%) |
| Same Version: | 1 (33.3%) | Same OS: | 3 (100.0%) | ||
[7 Oct 2001 5:33pm UTC] mtremblay at sitebrand dot com
[20 Nov 2001 12:31pm UTC] sander@php.net
This is what Derick said about this (in #14149): This is not a bug, the MySQL extension will open a new connection if the _current apache child_ has no open connection to MySQL. With this in mind, it's very normal to see that apache has multiple connections open to MySQL.
[20 Nov 2001 12:55pm UTC] derick@php.net
However, this is something else. This need to be investigated first.
[31 Dec 2001 7:08pm UTC] zak@php.net
Assigning to myself
[31 Dec 2001 7:16pm UTC] zak@php.net
doh.
[10 Jul 2002 9:27am UTC] georg@php.net
To fix this problem, you should set your mysql-server variable timeout_interactive to the number of seconds (default is 28800). For pconnect use the optional 4th parameter client_flags: mysql_pconnect($host, $user, $pass, MYSQL_CLIENT_INTERACTIVE); This allows interactive_timeout seconds (instead of wait_timeout seconds) of inactivity before closing the connection. This new optional parameter is available in the latest CVS-tree.
[30 Nov 2002 1:11pm UTC] diegoefe at yahoo dot com
I have the same problem running version 4.2.3 on a FreeBSD 4.6.2.
And I check the problem running this script:
<?
$con = mysql_connect('localhost','user','pass');
mysql_select_db('midb',$con);
$q = "Select * from categorias order by nombre limit 5";
$res = mysql_query($q,$con);
while($r = mysql_fetch_array($res,$con))
{
print "<p>".$r['nombre']."</p>";
}
print "<hr>";
$q = "Select * from vinculos order by nombre limit 5";
$res = mysql_query($q,$con);
while($r = mysql_fetch_array($res,$con))
{
print "<p>".$r['nombre']."</p>";
}
print "<hr>";
mysql_close($con);
?>
and checking the mysql client console with:
mysql> show status like "%onnection%";
and Max_used_connections incrementes like if the mysql_close didn't
exists.
