Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Succession of 4 MySQL errors from multiple SS sites


Go to End


7 Posts   2419 Views

Avatar
vwd

Community Member, 166 Posts

9 August 2012 at 6:59pm

Edited: 09/08/2012 6:59pm

Hi,

I periodically would receive a burst of emails from one of our SS (2.4.6) sites. But now I'm receiving it more frequently (fortnightly) from more of our SS sites.

I get the following 4 errors in quick succession:

Warning/Error #1

Warning: mysql_query() expects parameter 2 to be resource, boolean given
At line 116 in /home/site1/public_html/sapphire/core/model/MySQLDatabase.php 

mysql_query(SET CHARACTER SET 'utf8',) 
Line 116 of MySQLDatabase.php
MySQLDatabase->query(SET CHARACTER SET 'utf8') 
Line 60 of MySQLDatabase.php
MySQLDatabase->__construct(Array) 
Line 97 of DB.php
DB::connect(<filtered>) 
Line 121 of main.php

Warning/Error #2

Warning: mysql_error() expects parameter 1 to be resource, boolean given
At line 123 in /home/site1/public_html/sapphire/core/model/MySQLDatabase.php 

mysql_error() 
Line 123 of MySQLDatabase.php
MySQLDatabase->query(SET CHARACTER SET 'utf8') 
Line 60 of MySQLDatabase.php
MySQLDatabase->__construct(Array) 
Line 97 of DB.php
DB::connect(<filtered>) 
Line 121 of main.php

Warning/Error #3

Error: Couldn't run query: SET CHARACTER SET 'utf8' 
At line 525 in /home/site1/public_html/sapphire/core/model/MySQLDatabase.php 

Couldn't run query: SET CHARACTER SET 'utf8' 
Line 525 of MySQLDatabase.php
MySQLDatabase->databaseError(Couldn't run query: SET CHARACTER SET 'utf8' | ,256) 
Line 123 of MySQLDatabase.php
MySQLDatabase->query(SET CHARACTER SET 'utf8') 
Line 60 of MySQLDatabase.php
MySQLDatabase->__construct(Array) 
Line 97 of DB.php
DB::connect(<filtered>) 
Line 121 of main.php

Warning/Error #4

Warning: mysql_connect() [function.mysql-connect]: User site1_ss more than 'max_user_connections' active connections
At line 57 in /home/site1/public_html/sapphire/core/model/MySQLDatabase.php 

mysql_connect(<filtered>,<filtered>,<filtered>,<filtered>) 
Line 57 of MySQLDatabase.php
MySQLDatabase->__construct(Array) 
Line 97 of DB.php
DB::connect(<filtered>) 
Line 121 of main.php

What looked suspicious was the warning User site1_ss more than 'max_user_connections' active connections. I enquired of the web host who suggested that it was due to the code not closing mysql connections cleanly.

What do you think? These sites aren't even experiencing an enormous traffic spike at the times that the errors are being experienced.

Thank you very much.
VWD.

Avatar
Juanitou

Community Member, 323 Posts

9 August 2012 at 9:13pm

Hi,

You are not alone: I also get it all the time and it has been so for ages, no idea why.

Best regards,
Juan

Avatar
vwd

Community Member, 166 Posts

10 August 2012 at 8:55am

Hi Juan,

Thanks for letting me know - it's reassuring to know that I what I'm experiencing is not unique.

My web host confirms that the max_user_connections figure is 30. And the sites are not receiving anywhere near that figure in traffic. It's looking like SS isn't cleanly closing off MySQL connections?

What version of SS are you using Juan?

Thank you.
VWD.

Avatar
Juanitou

Community Member, 323 Posts

10 August 2012 at 9:53am

It happens both with 2.4.7 and 2.3.13 sites. I have not so many of them, so I don’t know if it’s also related to the host, but it only happens in one of them.

Avatar
DanielB

Community Member, 5 Posts

3 November 2013 at 8:03am

I'm getting similar errors now as well, for multiple sites.

Up and till now I have seen errors flowing though like this. Then just recently I started getting error 28 from storage engine errors. I followed it up with the host and the told me they were having trouble with one client overloading the shared hosting we were on.

I wonder if the errors you are getting above are also related to the hosting failing due to someone miss using the server.

Avatar
vwd

Community Member, 166 Posts

4 November 2013 at 3:17am

That's interesting @DanielB.

My issues must have had something to do with the web host as all the errors have cleared up without any code changes or other intervention on my part. The sites were hosted on a shared host.

It turned out that MySQL Governor (CloudLinux) was logged as clamping down on the sites at the times these errors were occurring. However, I did the math and the thresholds were quite generous and there was no way possible that the sites could come anywhere hitting these limits based on the logged traffic and the size of the DB / complexity of the queries.

Interestingly, the a large proportion (not all) of the errors occurred at the same time of day - which coincided with the hosts backup cron. Still some mysterious things were why none of the Wordpress sites we run were affected - only SS sites were affected.

It's getting close to a year now since we've had any of those issues thankfully - with no code changes.

Avatar
DanielB

Community Member, 5 Posts

5 November 2013 at 10:29am

I'm leaning this way too vwd. Our host ended up migrating us to a new server and all these errors disappeared.

I'm not sure if it had an effect but the only other thing we did different was upgrade to the latest versions of Silverstripe for many of these sites. We did this because of errors relating to the new server having php 5.4 on it.