Author Topic: exceeded the 'max_questions' resource  (Read 9241 times)

0 Members and 1 Guest are viewing this topic.

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
exceeded the 'max_questions' resource
« on: May 22, 2005, 10:35:56 PM »
Hello,

i get the error message on my site :
DB Error: Bad SQL Query: SELECT setting_name, setting_value FROM 4images_settings
User 'edupicsc_test' has exceeded the 'max_questions' resource (current value: 70000)

my host tells me this is because there are connections that stay open, and that should be something "wrong" in the code.

are you familiar with this problem ? and is there something to fix it ?

thx !!!


Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #1 on: May 23, 2005, 03:42:11 PM »
Personally I've never heard of it.

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #2 on: May 25, 2005, 10:37:00 AM »
this is what the technical staff mails me :

Prsently we have set max limit(no of requests) on our server as 70000 per account. This is prevention measure against server crash or any other damage to server. We have set this limit for better operation and if you are getting these errors again and again, you need to check your scripts(pages) are not using more no of the server resoucres, if so you should modify them so that they will nor exceed allowed server resoureces.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #3 on: May 26, 2005, 02:55:39 AM »
Maybe it's from a mod you installed?  In 3 years, I've never heard of this problem before.

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #4 on: May 29, 2005, 01:02:45 AM »
i just can't get it.
I have a "twin" site running in Dutch, with the same hosting company, and no problems on that site...
However...
on other forums they seem to know the problem also, and they suggest there that you make more than 1 user for your database, and if the limit is reached ( 70 000 ), you automaticly swith to the next user and that user can also take 70 000 connections.
The idea makes sense, but the code... i'm no good in that.
This is what was posted at the other forum, maybe someone can tell me if this can be used in 4images...
Code: [Select]
<?php 

// Database configuration 

$db_server ""
$db_name ""

// User configuration 

$db_username "user_1"
$db_password "pass_1"

if ( !
mysql_connect($db_server$db_username$db_password) ) { 

  $db_username "user_2"
  $db_password "pass_2"
   
} elseif ( !mysql_connect($db_server$db_username$db_password) ) { 

  $db_username "user_3"
  $db_password "pass_3"

} elseif ( !
mysql_connect($db_server$db_username$db_password) ) { 

  die("Database Connection Error!"); 
   


// Other Settings 

$filename        "";     // Specify the dump filename to suppress the file selection dialog 
$linespersession 3000;   // Lines to be executed per one import session 
$delaypersession 0;      // You can specify a sleep time in milliseconds after each session 
                           // Works only if JavaScript is activated. Use to reduce server overrun 

?>





















Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #5 on: May 29, 2005, 01:10:25 AM »
interesting information here :

http://forum.powweb.com/showthread.php?s=&threadid=23735

( not my host - powweb )

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #6 on: May 29, 2005, 01:26:14 AM »
i folowed the instructions mentioned in the link just above,
and now my config.php looks like this :

Code: [Select]
<?php
$db_servertype 
"mysql";
$db_host "localhost";
$db_name "edu_4homepages";
#$db_user = "xxxx4";
$db_user_array[] = "xxxx4"//enter 1st user name 
$db_user_array[] = "xxxx5"//enter 2nd user name 
$db_user_array[] = "xxxx6"//enter 3rd user name 
//regular variable 
$db_user $db_user_arrayrand0, ( sizeof($db_user_array) -) ) ]; 
$db_password "xxxxx";

$table_prefix "4images_";

define("4IMAGES_ACTIVE"1);

?>


off course the xxxx is covering up.

the site still works fine, lets see now if the problem is gone

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: exceeded the 'max_questions' resource
« Reply #7 on: May 29, 2005, 01:27:22 AM »
hmmm...intersting...normaly if a server has such limit, they provide only one database user anyway....am I wrong?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #8 on: May 29, 2005, 01:29:17 AM »
i could make 3 users for 1 database without any problem.
I just tried to make a 4th for the same database, and it could be done also.... i don't know what the limit is.

Do you think the new code in my config.php could solve this problem ?


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: exceeded the 'max_questions' resource
« Reply #9 on: May 29, 2005, 06:55:15 AM »
with your method it could work, but it could require refresh a page every time the randomly selected user was rejected by the server.
Here is an alternative way which will try every user from an array untill one succeed:

in config.php use this array:
Code: [Select]
$db_user = array(
  "username1" => "pass1",
  "username2" => "pass2",
  "username3" => "pass3"
);
(the $db_user variable will contein both usernames and their passwords, so u can leave $db_password variable empty DO NOT REMOVE IT though)

then in includes/db_mysql.php replace
Code: [Select]
    if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {with this:
Code: [Select]
    foreach ($db_user as $user => $pass)
    {
      if ($this->connection = $connect_handle($db_host, $user, $pass)) break;
    }
    if (!$this->connection) {
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: exceeded the 'max_questions' resource
« Reply #10 on: May 29, 2005, 11:19:02 AM »
thx a lot V@no !!!