pernest Posted October 5, 2009 Share Posted October 5, 2009 Hi I was hoping that someone could advise me if the following code in my php script could (under the right wrong circumstances) be generating a deadlock? Working with latest WAMP My data base contains two tables, "products" and "reviews", and my script has the code: mysql_query("LOCK TABLES products,reviews WRITE"); mysql_query("INSERT INTO products blah blah blah"); mysql_query("INSERT INTO reviews blah blah blah"); mysql_query("UNLOCK TABLES"); I think that running a single copy of this script would be fine, but I am trying to run ten copies concurrently. They will run successfully for 2 to 8 hours, then then freeze. Is it possible that one script could get a lock on products, and the the other get a lock on reviews, but that each script would then be looking for a lock on the other table? If this could be generating a deadlock, then how could I modify it to remove this problem? Many thanks Link to comment https://forums.phpfreaks.com/topic/176558-deadlocks/ Share on other sites More sharing options...
pernest Posted October 5, 2009 Author Share Posted October 5, 2009 I'm 99% certain that I have a deadlock situation right now. How can I diagnose if I really do, and what the query was that caused it. The tables that I believe are deadlocked are myISAM Cheers Link to comment https://forums.phpfreaks.com/topic/176558-deadlocks/#findComment-930811 Share on other sites More sharing options...
fenway Posted October 10, 2009 Share Posted October 10, 2009 And you're locking why? Link to comment https://forums.phpfreaks.com/topic/176558-deadlocks/#findComment-934514 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.