|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #7634 mysql_pconnect() + lock tables can hang server
Submitted: 2000-11-03 21:08 UTC Modified: 2002-06-10 04:10 UTC
From: Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0 Latest CVS (03/11/2000) OS: Mandrake 7.0
Private report: No CVE-ID: None
 [2000-11-03 21:08 UTC]
I've heard about this from a couple of sources and been
looking for answers, but haven't found anything 
definitive. I don't even know if it's solvable. However,
when using persistent connections and LOCK TABLES, if
for any reason the UNLOCK TABLES never gets executed,
the server ends up hanging while it waits for the lock
to get released.

This is reproduceable for me on every version of PHP I've 
tried. Example script:

<?php /* -*- mode: c++; minor-mode: font -*- */ 

$dbh = mysql_pconnect($host, $user, $pass);

/* Just to test the connection. */
if ($res = mysql_db_query($db, 'show tables', $dbh)) {
    while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
        echo $row["Tables_in_$db"] . "<br>\n";

echo "<hr>\n";
$table = 'category';
echo "Locking table '$table' (if the script blocks here, then the lock never got released)...<br>\n";
if ($res = mysql_db_query('chaps', "lock tables $table write", $dbh)) {
    echo "OK; locked.<br>\n";
} else {
    echo "failed; could not lock.<br>\n";
//$res = mysql_db_query('chaps', "unlock tables", $dbh)

Is this just me?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-20 19:46 UTC]
Can you try latest RC and see if the problem persists

 [2001-11-20 20:10 UTC]
Nope, still happens. This is on Debian woody, PHP 4.1.0RC3
(haven't tried on the win32 version you posted a link to,
but whatever).

Same script.

 [2001-11-20 22:05 UTC]
Closed as a Doc problem; added a warning in CVS about the
issue. Also included some info regarding transactions
behaving similarly from the user notes.
 [2002-06-10 04:08 UTC]
What is 'closing as doc problem' ? :) Reopening until it's really fixed.
 [2002-06-10 04:10 UTC]
My dear, it's already documented in the "Persistent Database" section ... sorry :-p
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed May 25 01:05:44 2022 UTC