Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Succession of 4 MySQL errors from multiple SS sites

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

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

Page: 1
Go to End
Author Topic: 1069 Views
  • vwd
    Avatar
    Community Member
    158 Posts

    Succession of 4 MySQL errors from multiple SS sites Link to this post

    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.

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: Succession of 4 MySQL errors from multiple SS sites Link to this post

    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

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: Succession of 4 MySQL errors from multiple SS sites Link to this post

    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.

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: Succession of 4 MySQL errors from multiple SS sites Link to this post

    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.

  • DanielB
    Avatar
    Community Member
    5 Posts

    Re: Succession of 4 MySQL errors from multiple SS sites Link to this post

    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.

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: Succession of 4 MySQL errors from multiple SS sites Link to this post

    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.

  • DanielB
    Avatar
    Community Member
    5 Posts

    Re: Succession of 4 MySQL errors from multiple SS sites Link to this post

    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.

    1069 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.