My site is having some problems and getting locked on an insert (cause lock) and then it tries to select b4 read lock is finished causing my script on calendar.php to lock the site up which causes it (during heavy traffic) to just keep reloading without finishing out the whole page.
Here is the exact message my administrator sent me: (t appears that your script is causing contention with the database it is trying to access. You are inserting (causing a lock) ) and then attempting to select, and the read lock isn’t complete yet. This is causing the lock contention that your calendar script is suffering from. Please reevaluate your code to streamline your queries and/or change it to atomic writes (by using the lock procedure)
What be the best thing to do at this point?? Because its causing me to miss out on THOUSANDS OF DAILY USERS).
Need help Quick
My site is Caltweet by the way.
thanks
r937
March 17, 2010, 3:12pm
2
the best thing to do at this point is to re-examine your php code and ensure that it isn’t the cause of the locks
also, if it’s a myisam table, which uses table locks, you might want to consider changing it to an innodb table, which uses row locks
r937:
the best thing to do at this point is to re-examine your php code and ensure that it isn’t the cause of the locks
also, if it’s a myisam table, which uses table locks, you might want to consider changing it to an innodb table, which uses row locks
I’m very new to coding. So what types of mistakes could i have made that would cause this type of problem in php so that I can know what to look for.
and I don’t even know the table diff total newbie. Mine is setup through VZ and i just create tables through Php/mysql commands. My host is hostgator if that helps.
thanks for all the help I really appreciate it
here is the code 2 the file in question if this helps…
<?php
$result = mysql_query("select uid, profile_image_url,screen_name from users order by made desc limit 12");
$num = 0;
while($row = mysql_fetch_array($result)){
$num++;
$img = $row['profile_image_url'];
if($img == "") { $img = "http://static.twitter.com/images/default_profile_normal.png"; }
$uid = $row['uid'];
$screen_name = $row['screen_name'];
echo "<a href=\\"./u/$screen_name\\"><img width=\\"48px\\" height=\\"48px\\" src=\\"$img\\"></a>";
if($num % 4 == 0){ echo "<br>"; }
}
?>
</div>
</div>
<div style="float:left;width:100%;">
<b class="wgb4"></b><b class="wgb3"></b><b class="wgb2"></b><b class="wgb1"></b></b>
</div>
</div>
</div>
<!--- END RECENT TWEETERS -->
<!--- SPOTLIGHT -->
<div style="width:420px;float:left;margin-left:30px;">
<div style="margin-left:0px;margin-top:0px;float:left;width:100%;">
<b class="wgtop"><b class="wgb1"></b><b class="wgb2"></b><b class="wgb3"></b><b class="wgb4"></b></b>
<div class="blue_box" style="height:200px; width:418px; color:#ffffff; text-align:center;">
<strong>Social Event Sharing</strong>
<ul style="size:8px; color:#000000; text-align:left;">
<li>Share/Find Events via Twitter, Facebook, Myspace, Email & other social media sites right from Caltweet</li>
<br>
<li>Caltweet is the fastest, easiest, & safest ways to Promote your events online</li>
<br>
<li>Print Guestlist & Have RSVP's Emailed Directly to your inbox <a href="http://caltweet.com/create.php">Click Here to Start</a> or <a href="howto.php">Learn How to Use Caltweet</a> </li>
<!-- <a href="http://caltweet.com/961">
<img src="http://www.calendartweet.com/imgs/caltweet-charity.jpg" title="Caltweet 4 Charity" alt="Caltweet 4 Charity"/></a><br /><font color="#000000">Click here:</font> <a href="/961">CalTweet 4 Charity</a><br />-->
<form style="margin-top: 10px;" action="./allevents.php" method="get">
<input onkeyup="searchEvents();" size="42" autocomplete="off" style="height:9; font-size:12px; padding:0px;" type="search" name="se" id="se" />
<input style="height:9; font-size:12px; padding:0px;" value="Search" type="submit" /><br />
<div style=" z-index:1000; position:absolute; visibility:hidden; text-align:left; margin:0px; padding:0px; width:330px; background-color:#CCCCCC;" name="search" id="search"></div>
</form>
</ul>
</div>
<div style="float:left;width:100%;">
<b class="wgb4"></b><b class="wgb3"></b><b class="wgb2"></b><b class="wgb1"></b></b>
</div>
</div>
</div>
<!--- END SPOTLIGHT -->
</div>
<div class="right">
<div class="tags"><div style="height:185px; overflow:hidden;"><img src="/imgs/section_names_03.jpg" />
<?php
$max = mysql_fetch_array(mysql_query("select max(tag_count) as max from tags"));
$max = $max['max'];
$small = 10;
$large = 25;
$num = 0;
$result = mysql_query("select * from tags order by rand() limit 15");
while ($tag = mysql_fetch_array($result)){
if($num > 0){ echo ", "; }
$num++;
$tagcount = $tag['tag_count'];
if($tagcount == "" || $tagcount < 1){ $tagcount = 1; }
$percent = $tagcount / $max;
$size = (($large - $small) * $percent) + $small;
echo "<font size=\\"{$size}px\\" style=\\"font-size: {$size}px;\\"><a href=\\"/t/". str_replace('+', '-', urlencode($tag['tag'])) . "\\">{$tag['tag']}</a></font>";
}
?></div><div style="height:100px; overflow:hidden;">
Follow the Creators:<br />
<a href="http://twitter.com/mrcaltweet"><img src="http://caltweet.com/imgs/freddy.jpg" width="55px" height="55px" /></a>
<a href="http://twitter.com/michaelrevell"><img src="http://a3.twimg.com/profile_images/457209831/6935_167176678078_697813078_3722745_2905007_n-1_normal.jpg" width="55px" height="55px" /></a>
</div>
</div>
</div>
</div>
<div class="bottom">
<!--- RECENT EVENTS -->
<div style="width:860px;float:left;margin-left:18px;">
<div style="margin-left:0px;margin-top:0px;float:left;width:100%;">
<b class="retop"><b class="reb1"></b><b class="reb2"></b><b class="reb3"></b><b class="reb4"></b></b>
<div class="re_box" style="height:120px; width:857px;">
<div class="re_pic"><img src="/imgs/section_names_14.jpg" /></div>
<div class="seperator"></div>
<?php
$result = mysql_query("select * from events join users on (user_id = uid) where ispublic = 1 order by created desc limit 4");
$i = 0;
while($row = mysql_fetch_array($result)){
$i++;
$event_id = $row['event_id'];
$hex_id = encode_eid($event_id);
$event_time = date("F j, Y, g:i a", $row['event_time']);
$link = "<a href='http://caltweet.com/$hex_id'>";
$event_title = stripslashes($row['event_title']);
//$event_pic = "<img width='300px' height='300px' src='{$row['event_pic']}'>";
$event_pic = max_picture($row['event_pic'], 120, 90, $event_title);
$event_desc = $row['event_desc'];