[opencms-dev] MySQLNonTransientConnectionException - too many connections

Paul-Inge Flakstad flakstad at npolar.no
Mon May 2 10:19:11 CEST 2011

Hi guys,

We recently launched our primary website on OpenCms (yay!). It is curretly at ~3000 pageviews a day. Not _that_ much traffic, but every so often (way too often), it "hangs" - often for as long as a minute or more.

This is what happens:

com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1070)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2748)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
        at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:65)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
        at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:176)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:207)
        at org.opencms.db.CmsSqlManager.getConnectionByUrl(CmsSqlManager.java:104)
        at org.opencms.db.generic.CmsSqlManager.getConnection(CmsSqlManager.java:231)
        at org.opencms.db.generic.CmsVfsDriver.readResource(CmsVfsDriver.java:1931)
        ... 75 more

The exception was not present in the several months of development and beta testing, so it's no doubt the traffic that's causing it. I've never seen this before, but then again, I've been working mostly on smaller sites with much less traffic. 

After learning of the setting in MySQL, I have (just now) set max_connections to 2048. No max_connections was present in my.cnf from before, so I'm guessing it was 100 (the default value).

Will this fix things? Should I do anything else, in order to allow many concurrent users / avoid this exception?

Best regards,

More information about the opencms-dev mailing list