4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: |Rene| on February 15, 2006, 07:48:08 PM

Title: Exceeded the 'max_connections' resource
Post by: |Rene| 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.
Title: Re: Exceeded the 'max_questions' resource
Post by: V@no 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...
Title: Re: Exceeded the 'max_questions' resource
Post by: |Rene| 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é

Title: Re: Exceeded the 'max_questions' resource
Post by: V@no 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...
Title: Re: Exceeded the 'max_questions' resource
Post by: |Rene| 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
Title: Re: Exceeded the 'max_questions' resource
Post by: Acidgod 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!
Title: Re: Exceeded the 'max_questions' resource
Post by: |Rene| 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).
Title: Re: Exceeded the 'max_questions' resource
Post by: Acidgod on February 18, 2006, 03:29:17 PM
Nun ja 100 Connections sind auch nicht viel... (o:
Title: Re: Exceeded the 'max_questions' resource
Post by: |Rene| 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.
Title: Re: Exceeded the 'max_questions' resource
Post by: IcEcReaM 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.
Title: Re: Exceeded the 'max_questions' resource
Post by: |Rene| 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.
Title: Re: Exceeded the 'max_connections' resource
Post by: IcEcReaM 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.
Title: Re: Exceeded the 'max_connections' resource
Post by: |Rene| on February 20, 2006, 04:55:04 PM
Connections werden demnach geclosed. Keine Ahnung woran es noch liegen kann, muss wohl noch weiter rumprobieren.
Title: Re: Exceeded the 'max_connections' resource
Post by: |Rene| 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?
Title: Re: Exceeded the 'max_connections' resource
Post by: IcEcReaM on February 23, 2006, 11:03:15 PM
http://www.4homepages.de/forum/index.php?topic=10764.0
Title: Re: Exceeded the 'max_connections' resource
Post by: |Rene| on February 24, 2006, 06:23:40 PM
Der Threat ist mir bekannt, beantwortet meine obere Frage aber leider nicht, zumindest was das die Zeile mit "num_rows" angeht.
Title: Re: Exceeded the 'max_connections' resource
Post by: IcEcReaM on February 24, 2006, 07:17:39 PM
genau das hängt aber zusammen damit.
Dadurch, dass die SQL Abfrage nicht richtig läuft,
kommt halt die Fehlermeldung mit den num_rows,
da das Ergebnis nicht entsprechend weiterverarbeitet werden kann.
Title: Re: Exceeded the 'max_connections' resource
Post by: Flo2005 on May 13, 2006, 02:07:18 PM
Hi, since 4 weeks we get very often this message
Quote
server reached MaxClients setting, consider raising the MaxClients setting

our provider helped us to configure the apache, but nothing really works fine... we have this error regulary :(

...someone knows what we´ve to do?
Title: Re: Exceeded the 'max_connections' resource
Post by: kindian on December 18, 2006, 12:50:30 AM
I'm running this problem too..

I've changed servers, did the last updates, but connections are still active and arent closed as they should....any fix yet?

 :(