Site down: exceeding maximum number of database connections :o{

Started by rexall9000, June 19, 2015, 10:47:15 PM

Previous topic - Next topic

rexall9000

Sat 20 Jun 2015, 9:34 am

Hi ForumMates,

I hope I am posting this in the correct section.  I have several SMF installations on the same server; the one in question is  SMF 2.0.10  http://www.khonkaenforum.net . We only have 100 members and modest traffic, but since last week have been getting 403 "cannot connect" errors.  This is explained (not that I understand it very well) as exceeding maximum number of database connections.

1.  Is this a known problem with SMF?

2.  Why is it happening?

3.  Is there a long-term fix or preventative? 
I have a bunch of SMF sites, so it is an important question.

Here is what the host, iPage, says

Quote from: iPage dudeHello,

The maximum number of concurrent MySQL connections per user is 10. It appears like at that time you have exceeded the above limit.The limits are based per database login, not Control Panel log in or MySQL CNAME. It's solely based on database login i.e. if you have one username connecting to 50 databases, there will be 50 connections, per database. You should use mysql_close () to close a normal connection at the end of the script or else the session with the database will be kept open. If you are using mysql_pconnect(), then such persistent connections are closed when the script finishes.

If you have any further questions, please update the Support Console.

Sincerely,

Santosh P
Technical Specialist

My site has been down for three days now, and this is very troublesome, I hope somebodies can offer some insight or even some help!

Thanks.

Aloha,

Rex
Khon Kaen, Thailand
[email protected]
http://www.khonkaenforum.com
http://www.mindbodythailand.net
http://rebtinfo.info


青山 素子

Quote from: rexall9000 on June 19, 2015, 10:47:15 PM
1.  Is this a known problem with SMF?

It's a known issue with bad webhosts. They promise "unlimited" and then put all kinds of arbitrary limits in place to make sure you can't use the resources they claim you have.

You appear to be hosting with iPage. They're owned by Endurance International Group, a notorious overseller (they own over 50 brands just to disguise themselves).


Quote from: rexall9000 on June 19, 2015, 10:47:15 PM
2.  Why is it happening?

It can happen more on poor hosts if you have added a bunch of modifications to SMF that increase database usage. You may also have turned on persistent connections in the server settings area of SMF. Doing so is normally a bad idea on shared hosting.


Quote from: rexall9000 on June 19, 2015, 10:47:15 PM
3.  Is there a long-term fix or preventative? 

Don't use crappy hosting providers.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


1Chope

Ipage is crap, I have used them and can confirm it. If you can run Ubuntu, why not get yourself an unmanaged VPS? It is as cheap if not cheaper than many shared hostings.

青山 素子

Quote from: 1Chope on June 20, 2015, 05:48:42 AM
If you can run Ubuntu, why not get yourself an unmanaged VPS? It is as cheap if not cheaper than many shared hostings.

If you don't know what you're doing, you'll wind up with more problems and an insecure setup.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


rexall9000

Sun 21 Jun 2015, 6:32 am

Hi Guys,

I appreciate your replies.  Unfortunately, my skill set is minimal, so my reaction to this is probably naive.  My tech guy has been working on this for 3 or 4 days now, consulting with the iPage tech people and we are still down!  I know iPage (et al) is crap, but there is crap and there is crap.  What does that mean exactly?  What should one expect or not expect from this kind of host?

1.  My site has been up and completely functional for nearly one year.

2.  Granted, we have had an increase in membership and activity the past couple of weeks, but nothing major; 100 members, dozens (not hundreds of posts), nothing graphics intensive.

3. Last week, ALL five of my sites (SMF & WordPress) on the same account were down briefly.  403 errors, cannot connect to database errors, forbidden errors.

a.  iPage said that other customers where reporting the same problem.
b.  Shortly thereafter, service was restored to ALL sites.
c.  KhonKaenForum.net then went down again, same issue as before, all my other sites are functional at this time.
d.  iPage is stikcing to it's story about maxed out database connections.

Could this all be coincidence?  Why is it happening now?  Could my sleepy little site be SUDDENLY be causing these problems? And why would this issue we so resistant to the efforts of my MIGHTY TECH GUY to restore service?

4.  The OP mentioned a "bunch" of mods.  Sorry for being naive, but how many is a "bunch"? How many is too many?  How many are you supposed to have.  Here is a list of packages on my server, I don't think they are all installed, I don't even remember what they all are just from the file name.

ad_mod_v3.2_SMF_v2-0
ad_seller_pro
addfbliketweetplusone_v1.0.3a
EmbedBBCode19
MenuEditorPro
mkress-smf_kitseositemap-2.2.1
passwdBoard
quickban
ShareThis
SimpleAudioVideoEmbedder3.1
SimplePortal_2.3.6
smf_gallery_pro
ultimate_profile-0-9-1_20

This modest to me and it doesn't seem "reasonable" that we are having these problems.  BTW, my other sites have similar stuffs, but not much traffic. I am perhaps being too naive, but please straighten me out if you can.

5.  Worst case scenario,  we have to change hosts.  I am on a serious budget (That is why we snapped up the $1/mo iPage deal),

a.  I would really appreciate suggestions from you guys as to which hosts you think are cheapest and best.
b.  I assume we are talking about a VPS, whatever that is?
c.  With most of them, can I have one account with multiple domains/sites as I do now?
d.  The specs are all over the place, how do I decide how much I need?

Your help is much appreciated, sorry for the newbie questions.

Aloha,

Rex
Khon Kaen, Thailand
[email protected]

http://www.mindbodythailand.net
http://rebtinfo.info

LiroyvH

Quote
a.  I would really appreciate suggestions from you guys as to which hosts you think are cheapest and best.
Cheapest and best don't always go hand in hand.
Have a look at the Paid Hosts & Hosting section here, all known to offer good performance; we have strict rules in place.

Quote
b.  I assume we are talking about a VPS, whatever that is?

No, your websites absolutely do not require a VPS. They require a decent shared host, that's all.

Quotec.  With most of them, can I have one account with multiple domains/sites as I do now?

Yep.

Quoted.  The specs are all over the place, how do I decide how much I need?

Check how much you're using now? Surely iPage will show you somewhere how much diskspace/traffic you're using...?
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

br360

Quote from: rexall9000 on June 19, 2015, 10:47:15 PM

My site has been down for three days now, and this is very troublesome, I hope somebodies can offer some insight or even some help!


While all the replies so far have been pretty accurate in my opinion, having too many connections should not really give you the message that you are receiving-
QuoteConnection Problems

Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.

Looks likes something might have changed in your settings.php maybe? Can you make sure all the info is accurate; especially the database password.

Kindred

No, that error has nothing to do with settings.php...  It is 100% a host side issue
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

br360

To have the "Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later." for days though? Isn't that the exact message one gets if they change say their database password or change the password in settings.php; yet don't change it in the other?

rexall9000

Quote from: CoreISP on June 20, 2015, 08:11:21 PM
Quote

Quote
b.  I assume we are talking about a VPS, whatever that is?

No, your websites absolutely do not require a VPS. They require a decent shared host, that's all.



Thanks v. much Core!  I'll have a looksee at the host section as you suggest.

As a "solution" iPage sugested their VPS,  beginning at around around $25/mo.

Do you guys agree with Core?  Four SMF sites and a couple of WP sites on one accout can be well served by a "decent" shared host?  Again, how does one define "decent"?

Thanks, lah!

Kindred

Br360...   No...   A bad password, or any other bad value in settings.pho will result in a different error, afaik,,,
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

青山 素子

Regardless, it's worthwhile to double-check that the database details in the Settings.php file are accurate. You could also try creating a new database user in your hosting control panel and switch to that.

Quote from: rexall9000 on June 20, 2015, 07:56:41 PM
I know iPage (et al) is crap, but there is crap and there is crap.  What does that mean exactly?  What should one expect or not expect from this kind of host?

There is only one level of crap. No shades. You're paying less than $2/mo, you shouldn't expect anything at that level. Just two tickets would cost iPage/Endurance way more than you pay them in several months. To be able to make a profit, they stuff hundreds of clients in every server and claim over-use of resources for anyone that complains.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


LiroyvH

Quote from: br360 on June 20, 2015, 09:28:36 PM
To have the "Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later." for days though? Isn't that the exact message one gets if they change say their database password or change the password in settings.php; yet don't change it in the other?

Not if it only displays that intermediately, like a flashlight turning off and back on. That can't be due to Settings.php containing wrong info.

Quote
Do you guys agree with Core?  Four SMF sites and a couple of WP sites on one accout can be well served by a "decent" shared host?  Again, how does one define "decent"?

It's not really the amount of sites that matter, but how big the sites are.
I've looked at the links you provided, and they're all low-traffic sites; usually not more than a few people online... Should work just fine on a proper host.

Decent is hard to define, as you have cheap hosts that rock the world, and expensive ones that still suck.
The general rule is: avoid anything offering unlimited diskspace, or basing itself on top of unlimited diskspace.
But also "500GB Diskspace, 5TB Traffic; just $5.95 USD/Month!" is a clear sign that you should steer clear and find something else.
If it's too good to be true, it usually is. The hosts in the paid hosts & hosting section here generally have solid plans, and a good reputation.
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

rexall9000

Sun 21 Jun 2015, 8:42 pm

Hi ForumMates,

Thanks so much for the helpful responses.  For those who have been following this and/or  give a poop, I think we have identified the problem, and it is an easy fix.  I got the response below form iPage when this first happened on the 17th.  At the time, it didn't make any sense to me, so have not been dealing with it . . . until the penny dropped just a while ago. Here is what iPage said:

Quote from: iPage dudeI apologize for the inconvenience you have experienced. I see that The A record for the domain 'khonkaenforum.net' is pointing to external IP address to 199.83.128.228(incapdns.net), it means website service is taken from third party.

There is/was another, similar forum that I used to babysit which has been retired.  The owner was nice enough to redirect the traffic  (16k hits per month) to my new forum.  I had completely forgotten that I had asked him to do that. But it and it looks like that is what is maxing out the databases.  We will know more tomorrow, but the redirect is the only thing new and is very likely the problem.

Geeze, never a dull moment.

Thanks, lah!

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

1Chope

Learning Ubuntu security is not all that hard, an average techy can know the basic within a week and have a forum that is more secured that all those host the running in any shared host cpanel/centos.
I maybe a bit harsh but I think every serious forum admins should learn Ubuntu, this is 2015!
-edit- no referral links allowed

Illori

not every forum had has the time and effort to put into learning any linux distro yet how to setup a web server and secure it. IMO it is better for any forum admin to have a managed host and let the pros deal with it.

青山 素子

Quote from: 1Chope on June 21, 2015, 02:50:06 PM
Learning Ubuntu security is not all that hard, an average techy can know the basic within a week and have a forum that is more secured that all those host the running in any shared host cpanel/centos.

The first indicator that you don't know what you're talking about is "Ubuntu security". The second is thinking that someone with a week of training will be better able to secure their system than those managing hosting professionally. There are certainly exceptions, and a very cheap host likely doesn't have experienced people managing their stuff because of costs, but I'd argue that the majority of decent hosts out there will do much better with security than someone with a week of experience that thinks Ubuntu is a proper server Linux distribution.

If you're interested in talking more about security, please do start a new topic. I'd love to discuss it. I've managed Linux and Unix systems for hosting professionally for over 12 years, and did similar server work as a hobby long before that. I've seen the pitfalls of not knowing enough, and am glad that the few things that happened to me early on were on a hobby system that was disconnected from anything important and that the damage was minimal because more experienced admins noticed issues and let me know. I'm a very strong proponent of learning how to manage security, but I also know it's a very complex topic that can take years to master. It's best to learn with assistance (managed services) that can help you than to be stuck on your own. Once you have that experience, it's then fine to go on your own.


Quote from: Illori on June 21, 2015, 03:16:10 PM
not every forum had has the time and effort to put into learning any linux distro yet how to setup a web server and secure it. IMO it is better for any forum admin to have a managed host and let the pros deal with it.

Exactly this. It's a lot of effort and a lot of specialty knowledge. If you aren't interested in the topic, then it's better to leave that area to those who are and focus on what you want to do.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


zorgon

Quote from: 青山 素子 on June 20, 2015, 02:21:46 AM
You may also have turned on persistent connections in the server settings area of SMF. Doing so is normally a bad idea on shared hosting.

This issue...   My hosting company was recently bought by someone else and we were moved to a shared server I was not aware of this until the forum gave us the database connect error

QuoteHello Ron,

We apologize for the inconvenience caused. I found that issue was due to max_user_connections. Unfortunately, it is not possible to increase it on shared servers. Currently, your application is using Persistent database connections and they do not close when the execution of your script ends. Due to this, your forum is creating more connections and database is inaccessible. Please ensure that your forum is configured to connect without Persistent database connections. To over come by exceeding the maximum concurrent connections, please close all open connections in your script when there is no scope for fetching data from database.

So my question is HOW to I disable persistent connections since I can not access the forum for 5 days now.  I am searching this forum for solutions and I see a lot of posts saying to disable it but not how to do that. I am not fluent in php... the SMF forum is provided from the server

Any help would be appreciated

Thanks

LiroyvH

Quote
This issue...   My hosting company was recently bought by someone else and we were moved to a shared server I was not aware of this until the forum gave us the database connect error

Did you have a VPS/dedicated before this? If so, it's absolutely wrong to move you to a shared server.
However, if you did not have a VPS/Dedicated: then them moving you to another shared server is not wrong.

Quote
So my question is HOW to I disable persistent connections since I can not access the forum for 5 days now.  I am searching this forum for solutions and I see a lot of posts saying to disable it but not how to do that. I am not fluent in php... the SMF forum is provided from the server

You can set it in server settings, iirc, in the admin panel; or otherwise look in Settings.php, you'll see:

$db_persist = 1;


Change to:

$db_persist = 0;


And save the file.
If it already is on 0, then you're not using persistent connections.

It sounds to me like you should probably just move to another provider that doesn't have extremely, borderline crazy, restrictive settings and/or can help you have a look. See paid hosts & hosting section here.
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

Advertisement: