Latest News: (loading..)
tgely

errors
Who see similar errors? - Too many connections in ..

22 posts in this topic

Who see these errors?

 

Quote

PHP Warning: mysqli_connect(): (08004/1040): Too many connections in
PHP Warning: mysqli_connect(): (HY000/1040): Too many connections in


Who see where and when used this function?
 

  function tep_db_close($link = 'db_link') {
    global $$link;

    return mysqli_close($$link);
  }


My guess they are in nexus. The problem is a blank page or mysql error message in browser. This is an everyday problem and tihs brothers me.

Share this post


Link to post
Share on other sites

I've never seen that error in my logs.

Share this post


Link to post
Share on other sites

I've seen that before. It means that the database connection limit is set too low, or the site is getting an unusually high number of visitors. Possibly both.

Regards

Jim

Share this post


Link to post
Share on other sites

Thanks @kymation and @frankl

I am tracking errors. I would like to find the real reason.

I have found a new one which is fake.

Quote

PHP Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on '127.0.0.1' (111) in



 

Share this post


Link to post
Share on other sites

Gergely: If you haven't done so and if it is available on your server, take a look at the MySQL error log for the server. On mine it is located at /var/lib/mysql/YOUR SERVER NAMe,err

It will list all of the "Too many connections" failures and you will probably find many entries by a single IP (hacker). One he triggers the failure, the server gives that message to any user on the server.

Share this post


Link to post
Share on other sites

Thanks @Jack_mcs I have no access to mysql log. I can reach the http log only.

@Gyakutsuki I have done but no usefull information.

Share this post


Link to post
Share on other sites

If you have access to the raw access log, you may be able to determine if it is due to a connection that way. It is more difficult, compared to the other log, but it lists the times so if you know when the failures occur, you may be able see a pattern. Also, some hosts will provide the log I mentioned. Some won't but it wouldn't hurt to ask.

Share this post


Link to post
Share on other sites

This problem is 99% of times down to an overloaded server.

Share this post


Link to post
Share on other sites

It can be due to an overloaded server but it can also be due to one, or more, attacks on the site. In my experience, it is almost always the latter. If someone decides to attack a site (DDOS), the easiest way to cause problems is to send many commands to the MySQL server. The only way to know for sure is to look at the logs.

Share this post


Link to post
Share on other sites

My problem is that I can not see the reason only the result. :unsure:

Enviroment:
- Shared host used but only one shop works on the site
- Remote MySQL is possible on this host but not enabled

Share this post


Link to post
Share on other sites

If you can't see the logs you can try installing View Counter. It will show you IP's hitting the account. If there are many hits from a certain IP at the time of the failure, that IP would be suspect. If you don't sell to all countries, I suggest you use the country blocking option since that can cut down the number of MySQL requests by quite a bit and may solve the problem by itself.

Share this post


Link to post
Share on other sites

Posted (edited)

I never get that error either.  You might be able to see some useful stats under Phpmyadmin on the status button.  I think some hosts mute what can be seen, but it's easy to check.

You can also check max connections under variables.

Edited by John W
added text

Share this post


Link to post
Share on other sites

@John W

Max connection is 100

From stats:
83 is The maximum number of connections that have been in use simultaneously since the server started.
Aborted clients:    332     The number of connections that were aborted because the client died without closing the connection properly.
:blink:

I have found this: https://dev.mysql.com/doc/refman/5.6/en/communication-errors.html

so it could be a lot of reason from hardware faults to hacking and configuration problems.

 

Share this post


Link to post
Share on other sites

I think there are always some failed and aborted connections and I think it's server wide when it shows that but I'm not positive.  My aborted are really small part of the total

Failed attempts    55     0.34     0.16%
Aborted            14     0.09     0.04%
Total            35 k    217.18     100.00%

       
       
       
Open new phpMyAdmin window

Share this post


Link to post
Share on other sites
On 10/8/2017 at 2:16 AM, Gergely said:

PHP Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on '127.0.0.1' (111) in

Thanks @kymation and @frankl

I am tracking errors. I would like to find the real reason.

I have found a new one which is fake.

All of the above, plus make sure that you can connect to 127.0.0.1. I sometime just setup for localhost only.

If you have DBA privilege, select * from mysql.user, should tell you the user setup.

Also, have your php write out the database engine status at error: show engine innodb status; Look for contention as I had just recently encountered locks wait that causing connections to reach it max allowed. Fixed the locks wait and no more connection errors. I also found out MySQL's transaction isolation level defaults to Repeatable Read, it can be problematic on large insert, update, delete. I think Oracle and Informix are both Read Committed. It seems overkill to me.

Something doesn't seem right, with the max connected at 85 but the max connection were set at 100. Was the DB rebooted since the error? I think with shared hosting you would have other shared hosts also connecting to the DB. I had never increased the max connections to fix any issues, it is probably a good idea to address the root cause before doing that. But may be if 85 connection is your normal load it would be a good idea to plan some surge capacity in it.

Hey, for $5 a month on the cloud you can have your own LAMP stack and access to all your logs. Its a good deal...

 

Share this post


Link to post
Share on other sites

I think your specific issue (mobile) is related to the redirect to the cookie_usage.php

try to change the cookie settings in admin to see if the error still occurs.

Sorry my mistake, i refer to a to many redirects issue i had, you have to many connections problem.

Edited by wHiTeHaT

Share this post


Link to post
Share on other sites

Thanks for everybody.

I have just changed the following for the goal
- converted all innoDB tables to myIsam (2 table maybe this is not important)
- changed sessions to file system for decrease table actions

I am waiting now what will be next. Last 5 days were clear and winter is coming..

Share this post


Link to post
Share on other sites

I've kept mine at myIsam and never changed to InnoDB. My site isn't very busy and this has worked since we changed to myIsam from whatever it was before.  Cpanel has some of the tables it uses as InnoDB, which are in the connection stats. 

Share this post


Link to post
Share on other sites

+one info after the session changed
 

select * from sessions;
Quote

Showing rows 0 - 29 (101 total, Query took 0.0160 sec)

It was over 100.

Share this post


Link to post
Share on other sites
2 hours ago, Gergely said:

 

select * from sessions;

  Quote

Showing rows 0 - 29 (101 total, Query took 0.0160 sec)

It was over 100.

It still is. :laugh: 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now