-->
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.  [ 3 posts ] 
Author Message
 Post subject: tomcat crash with too many open files in the system
PostPosted: Thu Jan 04, 2007 1:00 am 
Newbie

Joined: Thu Jan 04, 2007 12:27 am
Posts: 8
Hi

I am pretty much stuck with this problem, I am using hibernate with tomcat and c3p0 with mysql. After a while tomcat crashes with too many open files in the system. It happens too frequently, here are some details .. I didnt find anything helpful searching in forums, so i assume i am doing something wrong somewhere, any help will be appreciated.

Hibernate version:
hibernate3,
Configuration :
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">false</property>

<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.acquireRetryDelay">1000</property>
<property name="c3p0.acquireRetryAttempts">60</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->

<property name="c3p0.minPoolSize">3</property>
<property name="c3p0.maxPoolSize">20</property>
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">200</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->


Usage pattern :
org.hibernate.Session session = HibernateUtil.getSessionFactory().openSession();
Transaction txn = session.beginTransaction();

Query quert = session.createQuery( ");
query.list();
txn.commit();
session.close() ;

Full stack trace of any exception that occurs:
INFO | jvm 1 | 2007/01/03 17:49:50 | Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" java.lang.NoClassDefFoundError: com/mysql/jdbc/Messages
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:174)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:569)INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:971)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.Connection.createNewIO(Connection.java:2644)INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.Connection.<init>(Connection.java:1531)INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:978)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1774)
INFO | jvm 1 | 2007/01/03 17:49:50 | at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
INFO | jvm 1 | 2007/01/03 17:52:20 | Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1" java.lang.NoClassDefFoundError: com/mysql/jdbc/Messages
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:174)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:569)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:971)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mysql.jdbc.Connection.createNewIO(Connection.java:2644)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:978)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1774)
INFO | jvm 1 | 2007/01/03 17:52:20 | at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
INFO | jvm 1 | 2007/01/03 19:57:20 | Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" java.lang.NoClassDefFoundError: com/mysql/jdbc/SQLError
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2834)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.Connection.execSQL(Connection.java:3118)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.Connection.execSQL(Connection.java:3047)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.Statement.executeQuery(Statement.java:1166)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.DatabaseMetaData$9.forEach(DatabaseMetaData.java:4355)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.DatabaseMetaData$IterateBlock.doForAll(DatabaseMetaData.java:76)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mysql.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:4342)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectionNoQuery(DefaultConnectionTester.java:185)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:62)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.AbstractConnectionTester.activeCheckConnection(AbstractConnectionTester.java:67)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:329)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:279)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:329)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:279)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:269)INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1962)
INFO | jvm 1 | 2007/01/03 19:57:20 | at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
INFO | jvm 1 | 2007/01/03 19:57:32 | Exception in thread "Timer-2" java.lang.NoClassDefFoundError: com/mchange/v2/io/IndentedWriter
INFO | jvm 1 | 2007/01/03 19:57:32 | at com.mchange.v2.async.ThreadPoolAsynchronousRunner.getMultiLineStatusString(ThreadPoolAsynchronousRunner.java:281)
INFO | jvm 1 | 2007/01/03 19:57:32 | at com.mchange.v2.async.ThreadPoolAsynchronousRunner.access$100(ThreadPoolAsynchronousRunner.java:36)
INFO | jvm 1 | 2007/01/03 19:57:32 | at com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run(ThreadPoolAsynchronousRunner.java:616)INFO | jvm 1 | 2007/01/03 19:57:32 | at java.util.TimerThread.mainLoop(Timer.java:512)
INFO | jvm 1 | 2007/01/03 19:57:32 | at java.util.TimerThread.run(Timer.java:462)
STATUS | wrapper | 2007/01/03 22:37:42 | TERM trapped. Shutting down.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 1:03 am 
Newbie

Joined: Thu Jan 04, 2007 12:27 am
Posts: 8
Also c3p0 version is - c3p0-0.9.1-pre11.jar, I had same problem with an earlier version.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 3:53 am 
C3P0 Developer
C3P0 Developer

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

well, this is a weird one, but it's clear what's going on. c3p0 is trying, but failing, to acquire Connections from mysql. The failure is what's unusual: the class com.mysql.jdbc.Messages can't be loaded, while other mysql driver classes seem to be loadable just file.

Here's the URL of a similar issue, but unfortunately no solution is posted:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200603.mbox/%3C44071456.6030403@ste-energy.com%3E

You eventually run out of file descriptors because the driver has already opened a socket, but the thrown NoClassDefFoundError skips and internal cleanup and prevents a Connection from being returned, so no one can ever call close() on it.

I'm not sure what to tell you with this.

Here's are some suggestions: make sure there aren't somehow two incompatible versions of mysql's jdbc driver somehow visible to your application or tomcat. maybe download a fresh copy of the driver and tomcat, and try running your application from there, without any external CLASSPATH set (and ensuring that there is only a single copy of the jdbc driver jar files in your tomcat installation).

Do verify that mysql is installed and waiting for Conections. Prior to the NoClassDefFoundError, a CommunicationsException occurs -- maybe if you could prevent that from happening, the inability to load the Messages class wouldn't bite (though it's still bad -- and weird -- if unresolved). Try checking whether your app can connect to the database without connection pooling turned on.

Good luck!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.