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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Fatal Error for MySQL "Too many connections"

Go to End

3 Posts   2321 Views


3 Posts

31 August 2007 at 4:19am

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/

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!


3 Posts

1 September 2007 at 6:07am

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.


3 Posts

5 September 2007 at 1:36am

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.


# 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)
earch') + MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription,
ords) AGAINST ('Search') AS Relevance FROM `SiteTree_Live` WHERE (MATCH
MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST
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
MODE) AND ClassName = 'File') ORDER BY Relevance DESC LIMIT 0, 10;