-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: [lost connection]
PostPosted: Thu Sep 21, 2006 10:04 am 
Newbie

Joined: Thu Jan 19, 2006 12:09 pm
Posts: 3
Hibernate version: 3

Code between sessionFactory.openSession() and session.close():

_RootDAO.initialize();
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction tx = session.beginTransaction();

try {
...
listResult = session.createSQLQuery(requete).list();
Iterator iterRes = listResult.iterator();
...
while (iterRes.hasNext()) {
...
tx.commit();
session.close();
} catch (HibernateException e) {
tx.rollback();
session.close();
e.printStackTrace();
}



Full stack trace of any exception that occurs: 2006-07-10 11:31:05 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 08003
2006-07-10 11:31:05 ERROR [JDBCExceptionReporter] No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:


** BEGIN NESTED EXCEPTION **

com.mysql.jdbc.CommunicationsException
MESSAGE: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2692)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2621)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1552)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1607)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:121)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:745)
at com.osiris.moulinette.AutoReconnect.run(AutoReconnect.java:25)


** END NESTED EXCEPTION **



Last packet sent to the server was 1 ms ago.

STACKTRACE:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:



Name and version of the database you are using: mysql5.0.12



Hello,

I use hibernate3, java,flex1.5, mysql5.0 and tomcat5.5.
After several hours, i lose the connection with my database, and i MUST restart tomcat to use the application.
I developped some code to keep the connection every half hour :

try {
>> _RootDAO.initialize();
>> session = HibernateUtil.getSessionFactory().getCurrentSession();
>> tx = session.beginTransaction();
>>
>> System.out.println("DEBUT Autoreconnect2 " + new Date());
>>
>> session.createSQLQuery("select NOW()").uniqueResult();
>> Thread.currentThread().sleep(1080000);
>> System.out.println("fin Autoreconnect2" + new Date());
>> tx.commit();
>> session.close();
>> } catch (HibernateException e) {
>> session.close();
>> tx.rollback();
>> session.close();
>> e.printStackTrace();
>> System.out.println(e.getMessage());
>> } catch (InterruptedException e) {
>> System.out.println(e.getMessage());
>> }

That code can run for a many days, but when i try to use the application after several hours, i have the error, "JDBC Rollback failed". And i MUST restart tomcat.
Any idea ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 22, 2006 1:03 am 
Newbie

Joined: Tue May 10, 2005 2:32 pm
Posts: 14
Location: Quito, Ecuador South America
I am having the same problem but worst I never got Mysql 4.1.21 to connect using C3P0 or without any pool. So I found a DBCP provider in wiki:
http://wiki.apache.org/jakarta-commons/DBCP/Hibernate.

With this provider I was able to connect to Mysql 4.1.21 using Hibernate hibernate-3.2.0.cr3 and applications worked for a few days. But when I got a SQLExcpetion connection is lost and I have to restart tomcat.

Connection is also lost if I call session.save(Object) several times in a for loop


current configuration
Hibernate 3.2.0.cr3
TOmcat 5.5.16
MySQL : 4.1.21 standard
JDBC: mysql-connector-java-3.1.13-bin.jar

Here is my hibernate.cfg.xml file part where I set up dbcp :

Code:
      <property name="connection.zeroDateTimeBehavior">convertToNull</property>
      <property name="connection.provider_class">org.aplicationName.hibernate.connection.DBCPConnectionProvider</property>
      <property name="connection.pool_size">20</property>
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="cache.use_query_cache">true</property>
        <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
        <property name="show_sql">false</property>

        <!-- pool properties -->
        <property name="dbcp.maxActive">20</property>
        <property name="dbcp.maxIdle">10</property>
        <property name="dbcp.whenExhaustedAction">1</property>
        <property name="dbcp.maxWait">20000</property>
        <property name="dbcp.testOnBorrow">true</property>
        <property name="dbcp.testOnReturn">false</property>
        <property name="dbcp.testWhileIdle">true</property>
        <property name="dbcp.timeBetweenEvictionRunsMillis">1800000</property>
        <property name="dbcp.minEvictableIdleTimeMillis">900000</property>
        <property name="dbcp.numTestsPerEvictionRun">10</property>
        <property name="dbcp.validationQuery">SELECT NOW()</property>
       
        <property name="dbcp.ps.maxActive">20</property>
        <property name="dbcp.ps.maxIdle">10</property>
        <property name="dbcp.ps.whenExhaustedAction">1</property>
        <property name="dbcp.ps.maxWait">10000</property>



If someone could tell me how to get hibernate3 to work with a connection pool I ´ll be really greatful. I just moved from hibernate2.1 and never got this problems. I am really worried because I have to finish two applications and I cannot deliver like that.

_________________
Hernan Leon
Mindsoft


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 22, 2006 10:00 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Hi. I can't help you with the specifics of dbcp, but probably the issue is that mysql Connections time out after a period of time. You need to configure either Connection testing, Connection expiration, or both to avoid seeing Exceptions for broken Connections. It looks like you've tried to set this up in dbcp. I don't know enough about dbcp to tell you whether your configuration is correct, and how to verify whether the configuration you expect is taking effect.

If you want to try c3p0 again (I'm c3p0's developer, so I know a bit more about it), the main thing that confuses hibernate developers is that a few configuration parameters must be set in hibernate's config file, while most c3p0 parameters should be set in a separate file, usually c3p0.properties. It's confusing. (I hope it gets less confusing soon.)

For c3p0, you might try setting...

in hibernate's config:

hibernate.c3p0.acquire_increment=3
hibernate.c3p0.idle_test_period=300
hibernate.c3p0.timeout=600
hibernate.c3p0.max_size=20
hibernate.c3p0.max_statements=0
hibernate.c3p0.min_size=5

in c3p0.properties, try...

c3p0.preferredTestQuery=SELECT 1
c3p0.maxConnectionAge=3600
c3p0.testConnectionOnCheckout=true

c3p0.properties must be at the top level of your CLASSPATH, i.e. available as resource "/c3p0.properties" to c3p0's classloader. Note that c3p0.properties must be all lower case, and that the 0 is a digit, not a letter. When c3p0 pools initialize, they print a long, ugly configuration dump at INFO level in your logs. If you have any problems, it's a good idea to inspect this to verify that the configuration you expect is in fact taking effect in the pool.

There are other approaches to Connection testing then testing on checkout that perform slightly better, but I think you'll find SELECT 1 to be a fast test, and testing on checkout is very reliable, so this is a good starting point of you've had problems.

[maxConnectionAge only works with c3p0-0.9.1-pre7 and above. The latest prerelease is c3p0-0.9.1-pre9, and I'd recommend you try it. maxConnectionAge is different from hibernate.c3p0.timeout in that it times out Connections of a certain age regardless of whether or not they've been idle. hibernate.c3p0.timeout corresponds to c3p0.maxIdleTime, which only expires Connections that have remained unused for a period of time. Newer c3p0's are drop-in replacements to old versions. Just move the existing c3p0 jar out of hibernate's lib directory and drop in the new version's jar file to try the latest.]

Good luck!

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 1:50 am 
Newbie

Joined: Fri Oct 06, 2006 1:47 am
Posts: 1
Has anyone established a fix or workaround for this? Does it have anything to do with how the calling code is written, is it just a config issue, or is it a bug?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 10:42 am 
Newbie

Joined: Tue May 10, 2005 2:32 pm
Posts: 14
Location: Quito, Ecuador South America
Hello,

Sorry I have been out for a while. Steve thank you very much for the advise, I have set up C3P0 and was able to establish a connection and execute some statements against batabase and it works, but after the application is working for some time, the application gets really slow, for now I am testing in order to figure it out if this has anything to do with new Pool or not.

Quote:
Has anyone established a fix or workaround for this? Does it have anything to do with how the calling code is written, is it just a config issue, or is it a bug?


The main problem is that since hibnernate3 DBCP is no longer supported and you cannot use it anymore unless you use your own pool provider as http://wiki.apache.org/jakarta-commons/DBCP/Hibernate.

The problem with this provider is that it works with hibertanate3 until the first SQL error appears (for instance when you get a foreign key constraint error or something like that). When you get this error dbcp stops working with your application and you have to restart it.

Using C3P0 worked better, but I am steel testing it since I have received some reports that applications become slow, and I am not sure yet but sometimes connections are lost I am looking into right now.

I want to be able to work with a connection pool as I used to with hibernate2, I do not Know why I am having such a hard time in something that worked really well before and for now no more.

When I figure this out I will post what configuration work better.

cheers

_________________
Hernan Leon
Mindsoft


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 10:59 am 
Newbie

Joined: Tue May 10, 2005 2:32 pm
Posts: 14
Location: Quito, Ecuador South America
Hello,

Sorry I have been out for a while. Steve thank you very much for the advise, I have set up C3P0 and was able to establish a connection and execute some statements against batabase and it works, but after the application is working for some time, the application gets really slow, for now I am testing in order to figure it out if this has anything to do with new Pool or not.

Quote:
Has anyone established a fix or workaround for this? Does it have anything to do with how the calling code is written, is it just a config issue, or is it a bug?


The main problem is that since hibnernate3 DBCP is no longer supported and you cannot use it anymore unless you use your own pool provider as http://wiki.apache.org/jakarta-commons/DBCP/Hibernate.

The problem with this provider is that it works with hibertanate3 until the first SQL error appears (for instance when you get a foreign key constraint error or something like that). When you get this error dbcp stops working with your application and you have to restart it.

Using C3P0 worked better, but I am steel testing it since I have received some reports that applications become slow, and I am not sure yet but sometimes connections are lost I am looking into right now.

I want to be able to work with a connection pool as I used to with hibernate2, I do not Know why I am having such a hard time in something that worked really well before and for now no more.

When I figure this out I will post what configuration work better.

cheers

_________________
Hernan Leon
Mindsoft


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 8:07 pm 
Newbie

Joined: Tue May 10, 2005 2:32 pm
Posts: 14
Location: Quito, Ecuador South America
Ok I just have confirmed that there is a problem with C3P0 when
I make several save and update operations, at first application becomes really slow then it stops working:
Following is the last log entries made before it crashes the application:
It enters in a loop that never ends
Code:
2006-10-06 18:57:48,234 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 48, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:48,250 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1131) - awaitAvailable(): com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6
2006-10-06 18:57:48,250 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 48, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:48,390 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager (C3P0PooledConnectionPool.java:195) - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@1a462c9.acquireResource() returning.
2006-10-06 18:57:48,390 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 49, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:48,390 DEBUG [http-8080-Processor23] impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager (C3P0PooledConnectionPool.java:270) - Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@13bef50] on CHECKOUT.
2006-10-06 18:57:48,390 DEBUG [http-8080-Processor23] impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager (C3P0PooledConnectionPool.java:274) - Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@13bef50] on CHECKOUT has SUCCEEDED.
2006-10-06 18:57:48,390 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 49, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:48,406 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1131) - awaitAvailable(): com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6
2006-10-06 18:57:48,406 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 49, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:49,062 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager (C3P0PooledConnectionPool.java:195) - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@1a462c9.acquireResource() returning.
2006-10-06 18:57:49,062 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 50, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:49,062 DEBUG [http-8080-Processor23] impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager (C3P0PooledConnectionPool.java:270) - Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1a0df30] on CHECKOUT.
2006-10-06 18:57:49,078 DEBUG [http-8080-Processor23] impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager (C3P0PooledConnectionPool.java:274) - Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1a0df30] on CHECKOUT has SUCCEEDED.
2006-10-06 18:57:49,078 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 50, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:57:49,078 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1131) - awaitAvailable(): com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6
2006-10-06 18:57:49,078 DEBUG [http-8080-Processor23] resourcepool.BasicResourcePool (BasicResourcePool.java:1474) - trace com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1 [managed: 50, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@9ed5d6)
2006-10-06 18:58:04,265 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 18:58:04 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:04,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:04,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:29,265 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 18:58:29 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:29,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:29,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:54,296 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 18:58:54 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:54,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:58:54,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:59:19,265 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 18:59:19 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:59:19,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:59:19,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:59:44,265 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 18:59:44 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:59:44,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 18:59:44,265 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:09,296 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 19:00:09 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:09,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:09,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:34,296 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 19:00:34 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:34,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:34,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:59,296 DEBUG [Timer-0] resourcepool.BasicResourcePool$CullTask (BasicResourcePool.java:1645) - Checking for expired resources - Fri Oct 06 19:00:59 GMT-05:00 2006 [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:59,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1287) - BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]
2006-10-06 19:00:59,296 DEBUG [Timer-0] resourcepool.BasicResourcePool (BasicResourcePool.java:1308) - FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@b3a5d1]




Current c3p0 set up:

Code:
hibernate-config.xml
      <property name="hibernate.c3p0.min_size">5</property>
      <property name="hibernate.c3p0.max_size">50</property>
      <property name="hibernate.c3p0.idle_test_period">300</property>
      <property name="hibernate.c3p0.max_statements">0</property>
      <property name="hibernate.c3p0.acquire_increment">3</property>
      <property name="hibernate.c3p0.timeout">100</property>

c3p0.properties

c3p0.preferredTestQuery=SELECT 1 from dual
c3p0.maxConnectionAge=3600
c3p0.testConnectionOnCheckout=true
c3p0.acquireRetryDelay=1000
c3p0.acquireRetryAttempts=30
c3p0.breakAfterAcquireFailure=false


If someone has an idea I will apreciate it

regards

_________________
Hernan Leon
Mindsoft


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 9:07 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
hernanleon,

It looks like you have a Connection leak. Connections are being acquired and checked out, until the pool reaches its maximum size of 50. But they are not being checked back in!

The first thing to do is inspect your code, and make sure that any Connections you acquire, or resources like a Session that might wrap a Connection, are being properly cleaned up (closed, committed, disconnected) in an unskippable part of a finally block for any Connection checkout.

If you review your code and don't see any possible way that Connections might get checked out but not close()ed or cleaned up, try using the combination of c3p0.unreturnedConnectionTimeout and c3p0.debugUnreturnedConnectionStackTraces to see the stack traces of Connections that are checked back, but not checked back in a reasonable period of time. See this recent thread...

http://forum.hibernate.org/viewtopic.php?t=965562

...for more information about these properties. (You'll need to upgrade to c3p0-0.9.1-pre9, or at least c3p0-0.9.1-pre7, for these parameters to work.)

smiles,
Steve


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.