#28098 [Opn->Bgs]: mysql_pconnect never kills threads
| From: | iliaa@php.net | Date: | Thu, 22 Apr 2004 16:26:18 +0000 |
| Subject: | #28098 [Opn->Bgs]: mysql_pconnect never kills threads | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58585@lists.php.net to get a copy of this message | ||
ID: 28098
Updated by: iliaa@php.net
Reported By: moreau at myrealbox dot com
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: FreeBSD 5.2.1
PHP Version: 4.3.6
New Comment:
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
When using threads you should not be using persistent
connections, because PHP cannot identify existing
connections as already avaliable and therefor opens a new
persistent connection each time.
Previous Comments:
------------------------------------------------------------------------
[2004-04-22 08:36:07] moreau at myrealbox dot com
Thanks for your answer too, I didn't know that persistent connection is
not closed after ending script.
But I don't agree that such behaviour as I describe is normal. As I
mentioned pconnect generate new thread in each new running script.
BUT THIS IS THE SAME SCRIPT! So as said in documentation
pconnect should REUSE old connection , BUT DON'T generate
new connection. In practice - pconnet don't close any connection at
all, but don't reuse previous connection and
generate new.
Is this also correct behaviour ?
------------------------------------------------------------------------
[2004-04-22 01:54:05] 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
Persistent connections remain active until the Apache is
shutdown. This is expected behavior.
------------------------------------------------------------------------
[2004-04-21 22:02:35] moreau at myrealbox dot com
Yes, significantly.
Each script is successfully ended , so apache returns in
normal state ( minimal threads and process - as pointed in config )
after long timeout ( when pages aren't requested ). But MySQL has many
threads and no one of threads never die.
------------------------------------------------------------------------
[2004-04-21 19:19:51] gschlossnagle@php.net
mysql extension will create one connection per database
connect string per PHP interpreter context, i.e. one per
Apache thread or child. Is the number of connections
you are seeing exceeding your Apache thread count?
------------------------------------------------------------------------
[2004-04-21 19:17:21] moreau at myrealbox dot com
Description:
------------
mysql_pconnect every time generate new connection and never kill
previous.
As result - MySQL generate many threads for handling each query and
after too many connection hangs.
This never happened if use mysql_connect and mysql_close in each page.
I use apache2 . php compiled as module. apache use mpm=worker. I don't
know whether it problem in threadead apache or common problem in php
with mysql_pconnect.
mysql_pconnect in current state cannot be used for accessing to mysql.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28098&edit=1