Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Fatal Error for MySQL "Too many connections"

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1764 Views
  • filmbuff
    Avatar
    3 Posts

    Fatal Error for MySQL "Too many connections" Link to this post

    I just implemented silverstripe about two weeks ago and have been experiencing issues where the CMS hangs for awhile until I restart Apache, then everything goes back to normal. I had the hosting company take a look at the system logs and they didn't find anything. I had them send me an alert when the server utilization goes up and checked out the site while the CMS was hanging and got this error:

    FATAL ERROR: mysql_connect() [function.mysql-connect]: Too many connections
    At line 21 in /usr/web/www.nyfa.com/nyfa/film-school/sapphire/core/model/MySQLDatabase.php

    I cannot seem to figure out the problem because I'm not an experienced PHP developer nor a network engineer. Has anyone seen a similar issue? Any help would be appreciated. Thanks!

  • filmbuff
    Avatar
    3 Posts

    Re: Fatal Error for MySQL "Too many connections" Link to this post

    I had my hosting provider do a MySQL log whenever a mysql request takes longer than 10 seconds, and this is the log I have.

    use SS_mysite;
    SELECT `SiteTree_Live`.*, `UserDefinedForm_Live`.*, `SubscribeForm_Live`.*, `ArticlePage_Live`.*, `EventPage_Live`.*, `ErrorPage_Live`.*, `GhostPage_Live`.*, `RedirectorPage_Live`.*, `VirtualPage_Live`.*, `SiteTree_Live`.ID, if(`SiteTree_Live`.ClassName,`SiteTree_Live`.ClassName,'SiteTree') AS RecordClassName FROM `SiteTree_Live` LEFT JOIN `UserDefinedForm_Live` ON `UserDefinedForm_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `SubscribeForm_Live` ON `SubscribeForm_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `ArticlePage_Live` ON `ArticlePage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `EventPage_Live` ON `EventPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `ErrorPage_Live` ON `ErrorPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `GhostPage_Live` ON `GhostPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `RedirectorPage_Live` ON `RedirectorPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `VirtualPage_Live` ON `VirtualPage_Live`.ID = `SiteTree_Live`.ID WHERE (ShowInMenus = 1 AND ParentID = 0) ORDER BY Sort;

    I'm not sure if this is normal, let me know if anyone has any ideas.

  • filmbuff
    Avatar
    3 Posts

    Re: Fatal Error for MySQL "Too many connections" Link to this post

    This is the latest I heard from my hosting company:

    Here's an entry from slow query log. It matches a time when the site froze
    up for several minutes. It took 428 seconds to acquire lock on the
    tables. That matches what we've seen before with the "Too many
    connections" error. The https processes connect to the databse, but some
    other process has the tables locked, so everything just hangs waiting for
    the lock to disapear.

    A large number of processes builds up this way and the server hits
    max_connections limit.

    P.

    # Time: 070901 3:40:32
    # User@Host: nyfa[nyfa] @ localhost []
    # Query_time: 448 Lock_time: 428 Rows_sent: 10 Rows_examined: 58
    SELECT ClassName, `SiteTree_Live`.ID, ParentID, Title, URLSegment,
    Content, Last
    Edited, Created, _utf8'' AS Filename, _utf8'' AS Name, MATCH (Title)
    AGAINST ('S
    earch') + MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription,
    MetaKeyw
    ords) AGAINST ('Search') AS Relevance FROM `SiteTree_Live` WHERE (MATCH
    (Title,
    MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST
    ('Search*'
    IN BOOLEAN MODE) AND showInSearch <> 0) UNION SELECT ClassName,
    `File`.ID, _utf
    8'' AS ParentID, Title, _utf8'' AS URLSegment, Content, LastEdited,
    Created, Fil
    ename, Name, MATCH (Filename, Title, Content) AGAINST ('Search') AS
    Relevance FR
    OM `File` WHERE (MATCH (Filename, Title, Content) AGAINST ('Search*' IN
    BOOLEAN
    MODE) AND ClassName = 'File') ORDER BY Relevance DESC LIMIT 0, 10;

    1764 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.