php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28098 mysql_pconnect never kills threads
Submitted: 2004-04-21 19:17 UTC Modified: 2004-04-22 18:26 UTC
From: moreau at myrealbox dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.6 OS: FreeBSD 5.2.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: moreau at myrealbox dot com
New email:
PHP Version: OS:

 

 [2004-04-21 19:17 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-21 19:19 UTC] 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 22:02 UTC] 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-22 01:54 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

Persistent connections remain active until the Apache is 
shutdown. This is expected behavior. 
 [2004-04-22 08:36 UTC] 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 18:26 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

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. 
 [2011-07-07 17:28 UTC] jose dot nobile at gmail dot com
I don't found any form to use persistent connections.

No threads, no working
threads, no working
php in console, no working


What is the enviroment to use persistent connections?

Apache + forker
Apache + Worker
Apache + PHP fastcgi

Which???

This is not a bogus, is a real BUG of 7 years old.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC