php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23891 PHP doesn't close MySQL 4.0 persistent Connections > "Too Many Connections"
Submitted: 2003-05-30 04:36 UTC Modified: 2003-05-30 14:29 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jan dot lange at artada dot de Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.2 OS: Redhat 7.1
Private report: No CVE-ID: None
 [2003-05-30 04:36 UTC] jan dot lange at artada dot de
Hi!

I have upgrade to MySQL 4.0.12 (later to 4.0.13) with PHP 4.3.1 (and now also 4.3.2).

Persistent Connections in php.ini is "On"

It is a Webserver with many Sites on it. So after 2 to 4 hours every php page says "Too Many Connections"

So I look at Processlist, and there are more than 50 processes online!

I look with "show processlist" and it were exactly 100 rows in it, so it were 100 connections! 

When I restart apache, alle connections were closed and the php pages works fine for the next 2-4 hours.

I have made tests. And I'm thinking, this is a PHP Bug!
Because, I do ONE mysql request over PHP (with pconnect), so I have a persistent MySQL link!
I do exatly the same request again (refresh in browser) now I have 2 MySQL links, and so on.

The links were closed when MySQL have done a connection time-out, because there were always in state "sleep"

When I look at phpinfo() page, at the MySQL section I see on the activ Webserver 1 or 2 activ persistent links. But on MySQL it were 88 connections or more.

So I think, php close the MySQL connections and think they were closed, but they don't be in real.

On the latest MySQL 3.23 release, the Webserver have worked always fine with persistent connections.

Greetings
Jan

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-30 08:24 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

If you use mysql_select_db() or slightly different connection string you can have more open connections then you have process. That is the most likely case in your situation.
 [2003-05-30 12:25 UTC] jan dot lange at artada dot de
Yes I can have it!

But why don't use PHP the same connection again, for the same Connectiondetails?? Sometimes PHP do it, but sometimes PHP make a new link to MySQL and don't close the old link.

And why don't close PHP the persistent connection, after the time out of 60 seconds, that I have set in the php.ini file?

Befor I installed MySQL 4.0 on our Server, we have MySQL 3.23. And all the same scripts from all our customers works fine. It were always a pool of 5-8 persistent connections open, from Domains that have heavy load. All other Domains make a connection and after the 60 seks, the link were closed, an the mysql process for this connections is closed.

So I think in the MySQL 4.0 libs were made a Change, so that the persistent connection don't close correctly. PHP think it is closed (so it don't can use it again), but in real the link is open and sleep.....

Sorry, but I can't explain it good in english.

Jan
 [2003-05-30 14:29 UTC] georg@php.net
As ilia told you already, please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php

Also read documentation for persistent connections, and how to avtivate client interactive timeout via mysql_(p)connect.

bugs.php.net is not a support forum. For more information where to get help, check http://www.php.net/mailing-lists.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 07:01:30 2024 UTC