-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate hangs during startup
PostPosted: Mon Sep 10, 2007 1:22 am 
Newbie

Joined: Fri Sep 07, 2007 6:00 am
Posts: 1
Hi all.

We are facing a peculiar issue in one of our in-production applications. The application is a single threaded application that when started, connects to database through hibernate, checks some statistics and exits. Lately it has started hanging once in a while when hibernate code starts executing. We are using default hibernate connection pooling which should not really matter becoz in the course of the entire program just one connection is obtained and the database queried and thats it. and the deal is that hibernate hangs while trying to obtain the connection itself. The piece of code where hibernate hangs is from the class org.hibernate.connection.DriverManagerConnectionProvider in the getConnection method which is pasted below. When we look at the logs, the last log statement printed is "opening new JDBC connection". The log statement after that (ie "created connection to: " + url etc ) is not printed at all indicating that hibernate is hanging somewhere in between. We talked to DBA team and they said that it couldn't be because of connection starvation because database seems to have enough resources to allocate and the database side logs/ monitoring has not indicated any such crunch. Can somebody please help in this regard as to what are the potential situations under which this could be happening.

public Connection getConnection() throws SQLException {

if ( log.isTraceEnabled() ) log.trace( "total checked-out connections: " + checkedOut );

synchronized (pool) {
if ( !pool.isEmpty() ) {
int last = pool.size() - 1;
if ( log.isTraceEnabled() ) {
log.trace("using pooled JDBC connection, pool size: " + last);
checkedOut++;
}
Connection pooled = (Connection) pool.remove(last);
if (isolation!=null) pooled.setTransactionIsolation( isolation.intValue() );
if ( pooled.getAutoCommit()!=autocommit ) pooled.setAutoCommit(autocommit);
return pooled;
}
}

log.debug("opening new JDBC connection");
Connection conn = DriverManager.getConnection(url, connectionProps);
if (isolation!=null) conn.setTransactionIsolation( isolation.intValue() );
if ( conn.getAutoCommit()!=autocommit ) conn.setAutoCommit(autocommit);

if ( log.isDebugEnabled() ) {
log.debug( "created connection to: " + url + ", Isolation Level: " + conn.getTransactionIsolation() );
}
if ( log.isTraceEnabled() ) checkedOut++;

return conn;
}


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

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.