Random/latest images code causing max_user_connections issues (NOT cpmFetch) Random/latest images code causing max_user_connections issues (NOT cpmFetch)
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Random/latest images code causing max_user_connections issues (NOT cpmFetch)

Started by dagresham, April 28, 2007, 02:07:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dagresham

Hi,

I have some code in my theme.php to extract random/latest image data for use in my layout.  It's for a high traffic website with limited resources, but it runs the existing unmodified system fine.  My code is:


    $randoms = 2;
    for($i=0; $i < $randoms; $i++){
      $image = get_pic_data('random', $count, $album_name, 0, 1, false);
      $image = current($image);
      $random_images .= "<a href=\"displayimage.php?album=".$image['aid']."&pos=-{$image['pid']} \">".
                     "<img src=\"" . get_pic_url($image, 'thumb') . "\" ".
                     "class=\"leftmenuimage\"\></a><br /><br />";
    }
   
    //Get some latest images
    $latest_images = "";
    $latests = 2;
    $images = get_pic_data('lastup', $count, $album_name, 0, $latests, false);
    for($i=0; $i < $latests; $i++){
      $image = $images[$i];
      $latest_images .= "<a href=\"displayimage.php?album=".$image['aid']."&pos=-{$image['pid']} \">".
                     "<img src=\"" . get_pic_url($image, 'thumb') . "\" ".
                     "class=\"leftmenuimage\"\></a><br /><br />";
    }


I then pass $random_images and $latest_images as {RANDOM_IMAGES} and {LATEST_IMAGES} to the template parser.  All is well on the test system, but when I put it live it crashes the database with the max_user_connections issue.  Any idea what could be causing it?  It's my understanding that this code shouldn't require any more database connections than before (and just so nobody suggests it, I was using cpmFetch but it caused exactly the same problem).

I'd probably get into trouble for dumping the whole phpinfo here, although I can get it if people think it might be relevant.  max_user_connections is currently 64 and won't be raised due to cost issues.

Thanks,

Douglas

Nibbler

I can't see how that code is supposed to cause that error. It's probably caused by some other modification. Have you modified get_pic_url() atall? Can you post a link?