Database blocked because of many connection errors

10 posts by 5 authors in: Forums > CMS Builder
Last Post: November 11, 2015   (RSS)

By ennisoft - October 1, 2015

Hi,

On a school's website running CMSB, every couple of weeks the website goes down with the following error message:

We were unable to connect to the database, possibly because:

Your database settings are incorrect (check in /data/settings.dat.php)
Your database server is down or overloaded (check with your host)


The database error given was:
Host '<Control Panel Name>' is blocked because of many connection errors;
unblock with 'mysqladmin flush-hosts'

Obviously the hosting company says that it's the code that is the issue rather than their servers. Naturally I need to be sure this is not the case. What should I be looking for in the way of error logs? Any other pointers you can give?

The site was stable for a long period before this started.

Thanks,

Ross

By gregThomas - October 2, 2015

Hey Ross,

CMS Builder doesn't change the MySQL settings for the number of simultaneous connections, so this is most likely an issue with your hosting. Could you try contacting your hosting company saying you're getting this error:

The database error given was:Host '<Control Panel Name>' is blocked because of many connection errors;unblock with 'mysqladmin flush-hosts'

and ask them how you can increase the number of connections allowed to MySQL? Don't mention the PHP file that's caused it, as this isn't relevant.

If they still say it's related to CMS Builder, you can fill in a second level support request here:

https://www.interactivetools.com/support/email_support_form.php

and we'll try take a closer look at the issue.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By In-House-Logic - October 5, 2015

FWIW we had a similar issue crop up out of the blue last week. The became unusable as a result.

The hosting company did not allow us to run a flush-hosts command (blocked via limited permissions). Eventually they ran the flush and all was well.

I suspect that they may also have increased the connections allowance but I can't prove that.

J.

By ennisoft - October 12, 2015

Thanks for this guys, but it still seems to be beyond the abilities of the hosting team to raise the connections as required.

What does the number of connections depend on, is it determined by the code or the number of visitors to the site? And where are the errors likely to be generated (I'm assuming time outs from the server)?

The host support have asked me how many connections I expect to the server - sound like a "How long is a piece of string" question to me...

Ross

By Dave - October 14, 2015

Hi Ross, 

Googling for "is blocked because of many connection errors" shows some related info: 

It's nothing to do with regular mysql connections, it's caused by "connection requests from a host are interrupted without a successful connection".  

It's usually caused by exploit scanners, network problems at the host, websites getting overloaded and timing out after waiting a long time to connect to MySQL, etc.

But none of those things should cause you to get locked out of your own website, and it's definitely something your host should be able to resolve.  

Can you ask your host if they can review the mysql logs and see if they can confirm where the interrupted mysql connections are originating from (IP, mysql username, etc)?  And if they can update their configuration to prevent mysql from blocking known good hosts like your website?

Let us know what they say, and good luck!

Dave Edis - Senior Developer
interactivetools.com

By ennisoft - October 19, 2015

Hi Dave,

Thanks for the additional info - I'm not getting anywhere with the hosting company, here's a selection of their replies:

We made standard optimization for mysql configurations within your account. We checked and monitored the domain till time and it is loading fine with us now.

and

You are under "share hosting plan" and other customers use the same server. We have this issue only with your website - "blocked because of many connection errors" . Unfortunately we can not "increase max_connect_errors to 1000000 or setup a cron job to run "FLUSH HOSTS"" as it is very un-secure, and it take effect with our other customers. I've investigated it once again, I added more permission to your database user. Hopefully it will help at this stage.

The problem recurs daily now. Is there any chance that the code is the problem?

Thanks,

Ross

By ennisoft - October 19, 2015

Thanks Dave, that's pretty much the direction I was heading with this. Thanks for the great support as always!

Ross

By wevolutions - November 10, 2015

Hi Ross, I experienced this same exact problem a few years ago.

It all boiled down to getting a better hosting package.

Shared hosting for websites with lots of traffic just does not work out.

I switched to a Dedicated Server and all is fine after that switch.

Arif Khayam.

By ennisoft - November 11, 2015

Hi Arif, thanks for this, good to get confirmation that it is a service provider resource issue.

I'm passing this on to the customer (a secondary school), I'm sure they'll take exactly that action.

Ross