#33849 [Opn->Bgs]: LOCK TABLES with mysql_query() works wrong

From: Date: Mon, 25 Jul 2005 13:48:41 +0000
Subject: #33849 [Opn->Bgs]: LOCK TABLES with mysql_query() works wrong
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82410@lists.php.net to get a copy of this message
ID: 33849 Updated by: wez@php.net Reported By: test157 at starman dot ee -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Linux Fedora Core 4 PHP Version: 4.4.0 New Comment: Consult mysql support channels for further assistance. Previous Comments: ------------------------------------------------------------------------ [2005-07-25 03:48:10] test157 at starman dot ee Description: ------------ When I'am locking MySQL ISAM table from PHP env, all other threads still can use this table for READ/WRITE actions. But I didn't get from mysql_error() any message, and even cannot access other tables, untill they not locked too. So it's seems like PHP really thinks that MySQL locked. I think that this is problem of PHP because from MySQL console I can lock tables succesfuly, and after this lock even PHP cannot access this table. Reproduce code: --------------- mysql_pconnect("localhost","root",""); mysql_select_db("test_db"); mysql_query("LOCK TABLES test_table_1 WRITE"); mysql_query("INSERT INTO test_table_1 (a) VALUES (1)"); // returns OK mysql_query("INSERT INTO test_table_2 (a) VALUES (1)"); // Table was not locked with LOCK TABLES sleep(100); mysql_query("UNLOCK TABLES"); Expected result: ---------------- with this code I want to show you that all works fine, from side of thread what lock MySQL table. But really nothing is locked, during this 100 seconds I can edit/read test_table_1, without any problems from other threads. If I will even remove UNLOCK TABLES command and will use presistent connection, I will not hang up system. Because nothing is locked. Actual result: -------------- I tried it on PHP v 4.4.0/5.0.3/snapshots, CLI mode/Apache 2.0.54 compiled as worker/prefork, mysql v 4.1.12,13,14. And everywhere the same picture. I tried to compile PHP in different ways, from --disable-all + some only important keys, to full configs. Also tried to use budle MySQL libraries and what install on system. But all the same. Hope on your fast bug_fix. P.S: Also on this system I cannot flock(file) it all the same like with MySQL, no any error returned, but file no locked for other threads. (FS:ext2) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33849&edit=1

« previous php.bugs (#82410) next »