Author Topic: Exceeded the 'max_connections' resource  (Read 16673 times)

0 Members and 1 Guest are viewing this topic.

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Exceeded the 'max_connections' resource
« on: February 15, 2006, 07:48:08 PM »
Hi,

since a few days a get an max_questions error with my Website. I can't understand because I changed nothing in any SQL Statement. Now, I'm searching the problem on my localhost with xampp. When I visit the website and reload it some times, the max_questions (currently 100) are full and I can't connect to the DB anymore. Everytime when I reload the site, I get the following error message, the number I marked is changed every time the page is reloaded - what did it mean?

Is it possible that a query causes an error so that connections aren't closed? Furtheron I don't understand why 100 queries are full when I only reload the page for about 20 times :(

Please Help


DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name (FROM 4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id LIMIT 209, 1

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(FROM 4images_images i, 4images_categories c) LEFT JOIN 4images_us' at line 2


...after a couple of reloads...


DB Error: Bad SQL Query: SELECT setting_name, setting_value FROM 4images_settings
User 'user01' has exceeded the 'max_questions' resource (current value: 100)

-----------------------------------------------------------------------------------------------------------------------------------

EDIT: I changed the include folder from my installation with the a new one from this website. Now I don't get the error witch starts with

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.us...  but after a couple of reloads the connections are still full :cry:

I think the error message is a problem with the MySQL Server from Xampp (it's a Version 4 sql server), my hoster uses MySQL 5 and I made the changed for V5 as described in this forum.
« Last Edit: February 19, 2006, 06:12:08 PM by |Rene| »

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 #1 on: February 16, 2006, 12:35:22 AM »
I think you are right, the problem is in MySQL server itself...ask your host administrator to increase max_questions setting, or remove it at all...
I'm using MySQL v4.1.15 and I dont see any max_questions settings in the default installation...
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 |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_questions' resource
« Reply #2 on: February 16, 2006, 06:17:02 PM »
Yes, but my hoster uses My Sql V5, the problems came up for a few days, before all runs great. He will not increase the max connections because of performance. As I know the max connections are 100 by know (my hoster is a private person).

Can you say how many connections 4images uses normally and why there are so many connections or queries open? As I know the connections will be closed at the end of the script - so there couldn't be an amount of 100 connections or queries  :?

Regards
René


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 #3 on: February 17, 2006, 02:43:29 AM »
Sorry, I dont have an answer for your question, because this is mistery for me too. I've been trying find a reason why connections remains "active" in mysql even if used mysql_close() function...
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 |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_questions' resource
« Reply #4 on: February 18, 2006, 11:47:48 AM »
I try to find the problem with phpmyadmin. Everytime the index.php is executed, there is a new connections created and no connections are closed. You can see it in the runtime information from phpmyadmin.

Is there anybody who have the same problem? I'm using MYSQL 5

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Exceeded the 'max_questions' resource
« Reply #5 on: February 18, 2006, 03:13:55 PM »
Ich antworte mal in deutsch!


Quote
User 'user01' has exceeded the 'max_questions' resource (current value: 100)

Das bedeutet das Du 100 Querys/60 min absetzen, das sind nicht mal 2 Querys/min.

Das ist absolut nicht möglich unter diesen Umständen eine vernünftige dynamische Seite auf die Beine zu stellen!

Sind 2 User auf deiner Seite und wir gehen jetzt mal davon aus das bei jedem Seitenaufruf nur 1 Query gebraucht wird, dann kann jeder der beiden User sich in der Stunde max. 50 Seiten anschauen. Bei 4 Usern sind es nur noch 25 usw usw

Wenn dann ein SuMa Robot vorbei kommt der alleine schon pro minute min. 1 Seite aufruft werden deine Besucher ständig diese Meldung bekommen...

Mein Tip- wechsel den Hoster!

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_questions' resource
« Reply #6 on: February 18, 2006, 03:19:24 PM »
Sorry, das Problem sind wohl nicht die max_queries sondern die connections. Wenn ich lange genug durch die Seite klicke (so 50 mal klicken ;)) bekomm ich diese Meldung

Warning: mysql_connect() [function.mysql-connect]: User 'keitemeier001' has exceeded the 'max_connections_per_hour' resource (current value: 100) in F:\apachefriends\xampp\htdocs\bauwagencrew.net\includes\db_mysql.php on line 39

DB Error: Could not connect to the database server (localhost, user1).

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Exceeded the 'max_questions' resource
« Reply #7 on: February 18, 2006, 03:29:17 PM »
Nun ja 100 Connections sind auch nicht viel... (o:

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_questions' resource
« Reply #8 on: February 18, 2006, 07:55:44 PM »
Naja wieviel hast du denn für deine Galerie? Auch wenn ich 200 einstelle, sind diese schnell voll. Die Connections müssen ja geschlossen werden und nicht ständig offen bleiben.

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Exceeded the 'max_questions' resource
« Reply #9 on: February 18, 2006, 08:54:12 PM »
100 bzw 200 connections sollten doch für ne kleinere seite auf jeden fall reichen, oder?

Es zählen ja nur die offenene DB Connections.

4images schliesst diese nach Ablauf des Skripts.
Evtl. sind irgendwelche Servereinstellungen falsch,
da normalerweise nach Ablauf eines Skripts automatisch offene Connections geschlossen werden.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_questions' resource
« Reply #10 on: February 19, 2006, 06:02:05 PM »
Ich habe gerade eine neue Installation von 4Images vorgenommen auf mein Homepc. Habe die Änderungen für Mysql 5 durchgeführt und dann nur die Installation durchgeführt. Nach einigen Reloads waren 100 Connections voll. Ich denke hier liegt ein Fehler im Script vor, anders kann ich mir das nicht erklären.

EDIT: Kann mir auch vorstellen das es die meisten User garnicht merken da bei den Hostern meist automatisch ein Script läuft was die Connections zurücksetzt wenn diese voll sind.

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Exceeded the 'max_connections' resource
« Reply #11 on: February 19, 2006, 10:21:34 PM »
standardmässig benutzt 4images keine persistenten Verbindungen,
weswegen eigentlich von 4images alle offenen Verbindungen geschlossen werden.

Schau mal bitte in der includes/footer.php nach und such mal nach folgender Zeile:
Code: [Select]
$site_db->close();
ersetz das mal durch das:
Code: [Select]
if ($site_db->close()) echo "succesully closed";
else echo "not closed";

ruf deine index.php mal auf und schau ganz unten,
welche Meldung ausgegeben wird.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_connections' resource
« Reply #12 on: February 20, 2006, 04:55:04 PM »
Connections werden demnach geclosed. Keine Ahnung woran es noch liegen kann, muss wohl noch weiter rumprobieren.

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: Exceeded the 'max_connections' resource
« Reply #13 on: February 23, 2006, 08:47:36 PM »
Ich bekomm manchmal diese Fehlermeldung

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM galerie_images i, galerie_categories c LEFT JOIN galerie_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 1 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 9
Unknown column 'i.user_id' in 'on clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in F:\apachefriends\xampp\htdocs\4images\includes\db_mysql.php on line 116


Besonders die letzte Zeile interessiert mich, was bedeutet das? Habe bei Google was dazu gefunden, es scheint als ob die Funktion nicht Mysql 5 kompatibel ist.

Dann gibt es ja eine Funktion in der db_mysql.php die lautet

  function Db($db_host, $db_user, $db_password = "", $db_name = "", $db_pconnect = 0) {
    $connect_handle = ($db_pconnect) ? "mysql_pconnect" : "mysql_connect";
    if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {
      $this->error("Could not connect to the database server ($db_host, $db_user).", 1);
    }


Diese scheint meine Fehlermeldung zu Produzieren, also Could not connect to the database server (User, DB), kann man hier irgendwas ändern das der eventuelle Fehler nicht mehr abgefangen wird?
« Last Edit: February 23, 2006, 09:00:33 PM by |Rene| »

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump