• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: database connection errors
PostPosted: Thu May 14, 2020 4:50 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Apr 18, 2008 9:34 pm
Posts: 364
Location: Nimbin, Australia
If have a problematic site with frequent errors in CMSMS error log:

user xxx has exceeded the max_user_connections ...

I spoke to host, and they by now successfully updated it. so there's no immediate drama. However, the errors were logged on random times, mostly over night. Initially, I did not pay much more attention as it did not affect any real users, probably just bots.

Now, it happens more regularly, also during daytime hours, and I wonder if my poor programming has anything to do with it. I have numerous custom plugins connecting to another database to query this and that. the connection looks like this (courtesy of calguy1000)
\$1:
  //CMSMS 2.2+
  $cs = new \CMSMS\Database\ConnectionSpec;
  $cs->type = 'mysqli';
  $cs->host = $db_host;
  $cs->dbname = $db_db;
  $cs->username = $db_user;
  $cs->password = $db_pw;
  $db =  \CMSMS\Database\Connection::initialize( $cs );
 
i don't think i close those connections usually. $db->Close() i guess it is. but could the fact that i don't close the connection contribute to the above problem? but why would overnight where there's next to no traffic (except for bots maybe) be more problematic?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: database connection errors
PostPosted: Thu May 14, 2020 11:47 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7719
Location: The Netherlands
I have similar errors at a few sites, haven't found the cause yet either... :-/ Use all "regular" modules, no custom build ones.

_________________
$1

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return!



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: database connection errors
PostPosted: Thu May 14, 2020 3:32 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 958
Location: Victoria, BC
Could matching up the access logs to the time of the errors help see if there's a pattern? Perhaps bots are hitting urls with random parameters etc so they're not getting cached pages, resulting in lots of db hits?

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: database connection errors
PostPosted: Thu May 14, 2020 11:41 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Apr 18, 2008 9:34 pm
Posts: 364
Location: Nimbin, Australia
i have since seen the access logs. while i didn't see a pattern, there's one IP that just went nuts with requests. and many of these had not so random parameters, urlencoded queries like (decoded:)
\$1:
/**/AND/**/(SELECT/**/5983/**/FROM(SELECT/**/COUNT(*),CONCAT(0x7170706a71,(SELECT/**/(ELT(5983=5983,1))),0x7171717671,FLOOR(RAND(0)*2))x/**/FROM/**/INFORMATION_SCHEMA.PLUGINS/**/GROUP/**/BY/**/x)a)
Do you have any recommendations how to deal with attacks? i suspect just blocking the IP will probably only help for a day.
At least my plugins didnt cause this.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting