-->
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 not releasing mysql connection on Jetty
PostPosted: Mon Jul 31, 2006 2:46 pm 
Newbie

Joined: Mon Jul 31, 2006 2:41 pm
Posts: 13
I'm using hibernate with struts, on Jetty6, with Mysql 4.1.7. For some reason, even though I'm calling session.flush(), session.close() in my logic after any SQL or HSQL, hibernate does not seem to be releasing the connection. After 10 or so queries, this is what my linux box looks like when I do a ps -eaf:

mysql 9824 6184 0 10:19 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9843 6184 0 10:19 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9853 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9859 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9865 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9872 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9878 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9884 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9891 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9901 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9908 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9914 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9921 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9929 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9935 6184 0 10:20 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9966 6184 0 10:21 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9973 6184 0 10:21 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 9980 6184 0 10:21 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10012 6184 0 10:23 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10018 6184 0 10:23 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10027 6184 0 10:23 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10033 6184 0 10:23 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10040 6184 0 10:23 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10046 6184 0 10:23 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10066 6184 0 10:24 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10075 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10082 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10095 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10101 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10110 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10116 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10123 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10129 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10139 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10145 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10151 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10159 6184 0 10:25 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10166 6184 0 10:26 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10172 6184 0 10:26 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10178 6184 0 10:26 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10185 6184 0 10:26 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10195 6184 0 10:26 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
mysql 10207 6184 0 10:26 pts/2 00:00:00 /main/mysql/bin/mysqld --defaults-extra-file=/main/mysql/data/my.cnf --basedir=/main/mysql --datadir=/main/mysql/data --user
root 10210 6723 0 10:26 pts/3 00:00:00 ps -eaf



This is the simple logic in my struts app:


public static List getCallQ() {

Session session = null;
List callerList = null;

try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();


//Using from Clause
String SQL_QUERY = DemoSQL.callQ;
Query query = session.createQuery(SQL_QUERY);
callerList = query.list();

session.flush();
session.close();

}catch(Exception e){
//System.out.println(e.getMessage());
}finally{
try {
if (session != null) {
session.flush();
session.close();
}
} catch (Exception e) {}
}

return callerList;

}


Any suggestion would be appreciated. Thank you.


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.