#18551 [Com]: multiple pconnect => too many established TCP connection
| From: | levik at levik dot com | Date: | Mon, 04 Nov 2002 21:25:16 +0000 |
| Subject: | #18551 [Com]: multiple pconnect => too many established TCP connection | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-24060@lists.php.net to get a copy of this message | ||
ID: 18551
Comment by: levik@levik.com
Reported By: tl@ccf.fr
Status: Closed
Bug Type: MySQL related
Operating System: windows 2000
PHP Version: 4.2.2
New Comment:
I have the same problem on linux. Tried various configurations, using
both builtin and external MySQL libraries, but the problem persists. I
*KINDA* worked around it by setting a high connection limit for mysql,
and a low timeout value. This way, unused connections die quicker.
However this is murder on mem usage.
I *never* see connection count in phpinfo() go above 1, even though
persistent connections are on, and limited to 40. (Total connections
limited at 90). php seems to ignore these settings, as "show
processlist" in mysql shows 100 - 200 idle connections depending on
traffic load.
Previous Comments:
------------------------------------------------------------------------
[2002-10-08 18:04:27] maillists@conactive.com
Are you sure that this flag is the right cure? I see the same with PHP
4.2.2 on Windows via Apache 1.3.26. However, this does NOT occur when
using the same PHP setup over IIS. So, this seems to indicate for me
that the problem is actually with the php4apache.dll or with Apache.
------------------------------------------------------------------------
[2002-07-25 05:56:00] georg@php.net
Please download the current CVS version and use mysql_pconnect with the
optional parameter client_flags:
mysql_pconnect($user, $password, $host, MYSQL_CLIENT_INTERACTIVE);
This forces mysql to close idling persistent connections. You have to
set the variable interactive_timeout in your my.cnf (300 should be ok).
------------------------------------------------------------------------
[2002-07-24 18:52:21] tl@ccf.fr
PHP is running as apache module (apache version 2.0.39)
Multiple call to mysql_Pconnect on same mysqldb host
with eachtime same host,user and password parameters cause in somecase
to return different php ressourceID.
So, as persistent connection on php apache module will be available
until thread die, (silently) more and more opened connection to mysql
are made.
After a certain time, it causes apache to stop to serve http request
(without apache2 service die) with an "Cannot get free socket to listen
on 0.0.0.0:80) because at this time, it seems there is too many TCP
ESTABLISHED state connection between apache and mysql (near 80 on my
system).
Trying to play with multithreading apache configuration, can delay this
problem (serveral hours), but not resolve it;Same for apache keepalive
sets to on or off.
The only way I found to avoid this trouble is just use non-persistent
connection.
In this case I can observe that there is always one uniq ressource id
for the same host, user and password mysql_connect.
PS: Mysql and apache on the same computer.
Mysql, apache and php timeouts configurations are all sets by default.
Mysql, apache and php are newer installion on a newer W2000 computer.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18551&edit=1