PDA

View Full Version : "Too many connections" error?


ccw
11-13-2014, 11:44 AM
Hi,

Today I receive an error message as below:

Database error in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections /xxx/htdocs/includes/class_core.php on line 317

MySQL Error :
Error Number :
Request Date : Thursday, November 13th 2014 @ 04:32:30 AM
Error Date : Thursday, November 13th 2014 @ 04:32:30 AM
Script : http://forums.mysite.com/search.php?search_type=1
Referrer :
IP Address : ##.##.###.##
Username :
Classname : vB_Database
MySQL Version :

How to solve this problem?

Thanks

Dave
11-13-2014, 11:47 AM
<a href="http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html" target="_blank">http://dev.mysql.com/doc/refman/5.5/...nnections.html</a>
Increase the max_connections variable of MySQL.

RichieBoy67
11-13-2014, 02:16 PM
I agree with Dave. Change the setting in the mysql.cnf but also make sure you limit searches because these are very intensive and this is what is causing your issue. Only allow them 30 seconds apart and lower the max output as well.

ccw
11-13-2014, 02:27 PM
Thank you very much. I think the error is caused by DOS attacks. So how to prevent this? How to allow the search 30 seconds apart and lower the max output? Should I modify in vBulltin or in MySQL settings?

ozzy47
11-13-2014, 02:29 PM
What makes you think it is a Dos attack?

RichieBoy67
11-13-2014, 02:55 PM
Thank you very much. I think the error is caused by DOS attacks. So how to prevent this? How to allow the search 30 seconds apart and lower the max output? Should I modify in vBulltin or in MySQL settings?

Under message searching options in your admin panel.

I doubt it is ddos but you can check server logs to be sure.

ccw
11-13-2014, 08:40 PM
Because in the past, I also encounter similar error messages and sometimes there will be about thousands of such messages, which makes me believe that is a DOS attack.

ozzy47
11-13-2014, 09:56 PM
Well check your server logs and see. :)

ccw
11-14-2014, 12:32 PM
Now today I receive 39 "Too many connections" errors, as below:

Database error in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections /var/www/vhost/forums.datanumen.com/htdocs/includes/class_core.php on line 317

MySQL Error :
Error Number :
Request Date : Friday, November 14th 2014 @ 05:36:50 AM
Error Date : Friday, November 14th 2014 @ 05:36:50 AM
Script : http://forums.datanumen.com/private.php?do=newpm&u=15515
Referrer :
IP Address : 157.55.39.30
Username :
Classname : vB_Database
MySQL Version :

and

Database error in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections /var/www/vhost/forums.datanumen.com/htdocs/includes/class_core.php on line 317

MySQL Error :
Error Number :
Request Date : Friday, November 14th 2014 @ 05:42:33 AM
Error Date : Friday, November 14th 2014 @ 05:42:34 AM
Script : http://forums.datanumen.com/entry.php/4-Methods-Girlfriend
Referrer :
IP Address : 199.58.86.206
Username :
Classname : vB_Database
MySQL Version :

The error body will be different a little, but all said "Too many connections"

It seems that the attacker is try to using different way to attack my server. Is there a way to prevent this, other than just increase the max connection for My SQL?

Thanks

ForceHSS
11-14-2014, 12:34 PM
Getting a better host if the one you have can't handle what it has now

ozzy47
11-14-2014, 12:39 PM
What server type is this, shared, VPS or dedicated?
What is your max_connections set to?

I see this is a new forum, and there is basically nothing on it, so you should not get overloaded.

Perhaps read this post, http://ozzmodz.com/showthread.php/506-The-Era-Of-Big-Spam-Is-Over and install the Ban Spiders by User Agent and Hostname or Useragent Registration Ban modifications, to block bad bots and spiders.

Dave
11-14-2014, 12:42 PM
Check the access.log to be entirely sure it's a DoS attack.
Also it's odd that your web-server doesn't crash, but your MySQL server does. It's usually the other way around.

If you're entirely sure it's a DoS attack, you can do several things:
1) Find which IP is doing it and block the IP. A DoS attack is 1 IP, a DDoS attack is sent from a bunch of infected hosts.
2) Go to a host which offers DDoS protection. (Expensive)
3) Use Cloudflare and enable "I'm under attack mode" at the security settings. This should eliminate most attacks. Be sure that you only allow connections to your webs-server from Cloudflare its IP's if you do this.

RichieBoy67
11-14-2014, 02:21 PM
I doubt it is a dos attack hitting the search.php page.

Running a search will require resources and if maxed out, any extra connection will give the max connection error. If your site is even just fairly busy you can get hundreds of these errors once you peak.

Does this happen at the same daily? maybe your site is running a cron task at that time or doing a back up which is also using resources.

If you are on a shared host your host will most likely spot a real ddos attack long before you will. If on a dedicated that is a different problem all together.