Cannot get a connection, pool error Timeout waiting for idle object :sakai

siddhant picture siddhant · Feb 20, 2014 · Viewed 20.5k times · Source

iam using sakai 2.9.1 after a few operations the server stops responding and prints log:-

2014-02-20 12:48:47,085 WARN http-bio-8080-exec-18 org.sakaiproject.db.impl.BasicSqlService - Sql.dbRead: sql: select SAKAI_SITE.SITE_ID,SAKAI_SITE.TITLE,SAKAI_SITE.TYPE,SAKAI_SITE.SHO 
RT_DESC,SAKAI_SITE.DESCRIPTION,SAKAI_SITE.ICON_URL,SAKAI_SITE.INFO_URL,SAKAI_SITE.SKIN,SAKAI_SITE.PUBLISHED,SAKAI_SITE.JOINABLE,SAKAI_SITE.PUBVIEW,SAKAI_SITE.JOIN_ROLE,SAKAI_SITE.IS_SPE
CIAL,SAKAI_SITE.IS_USER,SAKAI_SITE.CREATEDBY,SAKAI_SITE.MODIFIEDBY,SAKAI_SITE.CREATEDON,SAKAI_SITE.MODIFIEDON,SAKAI_SITE.CUSTOM_PAGE_ORDERED,SAKAI_SITE.IS_SOFTLY_DELETED,SAKAI_SITE.SOFT
LY_DELETED_DATE from SAKAI_SITE where ( SITE_ID = ? ) !admin 
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object 
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104) 
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) 
        at org.sakaiproject.db.impl.BasicSqlService.borrowConnection(BasicSqlService.java:260) 
        at org.sakaiproject.db.impl.BasicSqlService.dbRead(BasicSqlService.java:540) 
        at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:341) 
        at org.sakaiproject.util.BaseDbFlatStorage.getResource(BaseDbFlatStorage.java:321) 
        at org.sakaiproject.site.impl.DbSiteService$DbStorage.get(DbSiteService.java:236) 
        at org.sakaiproject.site.impl.BaseSiteService.getDefinedSite(BaseSiteService.java:616) 
        at org.sakaiproject.site.impl.BaseSiteService.getSite(BaseSiteService.java:702) 
        at org.sakaiproject.site.impl.BaseSiteService.getSiteVisit(BaseSiteService.java:780) 
        at org.sakaiproject.site.cover.SiteService.getSiteVisit(SiteService.java:140) 
        at org.sakaiproject.presence.tool.PresenceTool.doGet(PresenceTool.java:141) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:634) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) 
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471) 
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:369) 
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329) 
        at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:511) 
        at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1470) 
        at org.sakaiproject.portal.charon.handlers.PresenceHandler.doPresence(PresenceHandler.java:140) 
        at org.sakaiproject.portal.charon.handlers.PresenceHandler.doGet(PresenceHandler.java:70) 
        at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:881) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:695) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) 
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) 
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) 
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) 
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) 
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
        at java.lang.Thread.run(Thread.java:619) 
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object 
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1167) 
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)

Answer

Aaron Zeckoski picture Aaron Zeckoski · Jun 6, 2014

You probably need to increase the size of your connection pool. You may need to also adjust the DBMS settings for your database. Here are the settings which you would put into your Sakai configuration file (typically sakai.properties) to control the database pooling.

# The initial number of connections that are created when the pool is started
[email protected]=10
# The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit.
[email protected]=50
# The maximum number of active connections that can remain idle in the pool, without extra ones being released, or zero for no limit.
[email protected]=5
# The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none.
[email protected]=5