Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Bruno Galvao
Connection Pool Leak on GlassFish
March 2, 2012 7:04 AM
Answer

Bruno Galvao

Rank: Junior Member

Posts: 58

Join Date: August 26, 2011

Recent Posts

I kept getting
[Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.]
so I set Leak Timeout to 300 and now I get the following error every minute. What can I do?

Log Entry Detail


Timestamp Mar 2, 2012 09:53:14.816
Log Level WARNING
Logger javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.pool
Name-Value Pairs _ThreadID=53;_ThreadName=Thread-2;
Record Number 839
Message ID
Complete Message A potential connection leak detected for connection pool LiferayPool. The stack trace of the thread is provided below : com.sun.enterprise.resource.pool.ConnectionPool.setResourceStateToBusy(ConnectionPool.java:324) com.sun.enterprise.resource.pool.ConnectionPool.getResourceFromPool(ConnectionPool.java:758) com.sun.enterprise.resource.pool.ConnectionPool.getUnenlistedResource(ConnectionPool.java:632) com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:526) com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381) com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:242) com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:167) com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:338) com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:301) com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:190) com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165) com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160) com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:113) org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:403) org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376) $Proxy111.prepareStatement(Unknown Source) sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:601) org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:71) $Proxy338.prepareStatement(Unknown Source) org.quartz.impl.jdbcjobstore.StdJDBCDelegate.countMisfiredTriggersInStates(StdJDBCDelegate.java:333) org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3114) org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3896) org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3916) Monitoring Statistics : Monitoring Statistics for LiferayPool

Juan Gonzalez
RE: Connection Pool Leak on GlassFish
March 2, 2012 10:00 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1864

Join Date: October 28, 2008

Recent Posts

Sorry this seems a glassfish problem. Check how is working your connection pool in admin console, and connection params.
Bruno Galvao
RE: Connection Pool Leak on GlassFish
March 2, 2012 11:17 AM
Answer

Bruno Galvao

Rank: Junior Member

Posts: 58

Join Date: August 26, 2011

Recent Posts

Turns out I think it was a network issue. Having trouble connecting to the database.
Juan Gonzalez
RE: Connection Pool Leak on GlassFish
March 2, 2012 11:33 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1864

Join Date: October 28, 2008

Recent Posts

Bruno Galvao:
Turns out I think it was a network issue. Having trouble connecting to the database.


Yep, what I meant is that this isn't a Liferay problem. What DB do you use? Can you paste here your connection pool config?
Bruno Galvao
RE: Connection Pool Leak on GlassFish
March 2, 2012 12:23 PM
Answer

Bruno Galvao

Rank: Junior Member

Posts: 58

Join Date: August 26, 2011

Recent Posts

Juan Gonzalez P:
Bruno Galvao:
Turns out I think it was a network issue. Having trouble connecting to the database.


Yep, what I meant is that this isn't a Liferay problem. What DB do you use? Can you paste here your connection pool config?



SQL Server with Connection Pool Config:






Juan Gonzalez
RE: Connection Pool Leak on GlassFish
March 2, 2012 12:21 PM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1864

Join Date: October 28, 2008

Recent Posts

Guess you didn't paste properly. Image isn't available.
Bruno Galvao
RE: Connection Pool Leak on GlassFish
March 2, 2012 12:24 PM
Answer

Bruno Galvao

Rank: Junior Member

Posts: 58

Join Date: August 26, 2011

Recent Posts

Should be good now..
Juan Gonzalez
RE: Connection Pool Leak on GlassFish
March 2, 2012 1:15 PM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1864

Join Date: October 28, 2008

Recent Posts

Bruno Galvao:
Should be good now..


You can try changing that ConnectionPoolDataSource to simpler DataSource.

Not sure if "pooling" value has a right value (unless is the default value).

Another thing to consider, pool max connections should depend on your liferay requests. If there are many requests at the same time, perhaps this value should be increased.
Johan de jong
RE: Connection Pool Leak on GlassFish
July 25, 2012 4:07 AM
Answer

Johan de jong

Rank: Junior Member

Posts: 35

Join Date: February 6, 2012

Recent Posts

Please be aware that this is an OS related issue.

I have seen this happen with a selfmade portlet where at some moment a table with several rows needs to be updated. The update is executed as a loop that updates every single row.
On a Windows server i had no problems, but on a Solaris server (which clearly has better multitheading strategy) i ran out of connections very easy.

I saw on my Solaris server that i could have 500 connections to my database within one second. After the idle-time-out all connections are freed by Glassfish, but you must tweak this time-out to 5 seconds or so. After 5 seconds the connections drop from 500 to the set "Initial and Minimum Pool Size"