-->
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.  [ 4 posts ] 
Author Message
 Post subject: postresql eats up memeory
PostPosted: Wed Aug 16, 2006 12:20 pm 
Newbie

Joined: Fri Jan 27, 2006 11:14 am
Posts: 12
Hi, i m using Hibernate, Spring and Tapestry and PostgreSQL in my software. this software includes extensive database opertaions incl query, update, insert, but no db creation or such.

atm all functions are working properly, but a serious problem is that after a buntch of method calls my memory is running out. i checked system status and i noticed there are almost 70 pgadmin.exe threads! and the figure is rising as more db operations are performed. it seems that each time a query is made, a separate thread is created, and none is released. does hibernate create a separate connection each time a query is made?

is it because i did wrong with configuration? or theres serious problem in my code? i have this line in my applicationContext.xml,,

<property name="maxOpenPreparedStatements"> <value>100</value></property>

would it be the cause? that value=100 is too big?


how can i solve this problem please, thanks very much!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 5:39 pm 
Newbie

Joined: Fri Jan 27, 2006 11:14 am
Posts: 12
any idea please, thnx!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 7:20 pm 
Newbie

Joined: Fri Jan 27, 2006 11:14 am
Posts: 12
mm i think the problem is my database connection configuration, as such


--------------applicationContext.xml-----------------------
<bean id="tuitionDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" >
<property name="driverClassName"> <value>org.postgresql.Driver</value> </property>
<property name="url"> <value>jdbc:postgresql://localhost/tuition</value> </property>
<property name="username"> <value>pgadmin</value> </property>
<property name="password"> <value>1261110zzq</value> </property>
<property name="maxActive"> <value>4</value> </property>
<property name="maxIdle"> <value>4</value> </property>
<property name="minIdle"> <value>2</value> </property>
<property name="maxWait"> <value>-1</value> </property>
<property name="initialSize"> <value>2</value> </property>
<property name="poolPreparedStatements"> <value>true</value> </property>
<property name="maxOpenPreparedStatements"> <value>100</value> </property>
<property name="testOnBorrow"> <value>true</value> </property>
<property name="testOnReturn"> <value>false</value> </property>
<property name="testWhileIdle"> <value>false</value> </property>
<property name="validationQuery"> <value>SELECT 1+1</value> </property>
</bean>



there isnt connectio pooling config, such as

hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50

however how can i incorporate this into applicationContext.xml?( i dont know if limit number of connections is good. what if qeuries happen when the max conn number has been reached?)

could anyone give me some directions on this problem please, how can i solve this?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 17, 2006 5:46 am 
Newbie

Joined: Fri Jan 27, 2006 11:14 am
Posts: 12
hi, sorry there are a few errors in my description, its postgres.exe, not pgadmin. and one thing to add, im using Netbeans as development IDE. i researched a little after this post and i now think

the config should be correct. im using dcpd pooling instead of c3p0, and this line <property name="maxActive"> <value>4</value> </property> is dcpd way of setting max connection=4. so technically the program cannot create more than 4 connections.

i studied in depth how the thing happens, and it appears that, every time a WEBPAGE that includes CERTAIN NUMBER of hibernate database operations is reqeusted, exactly 2 postgres.exe is created. no matter how many database operations there are on a single page, 1,2, or 10, its exactly 2 postgres.exe created. and this keeps happening like a plague until too many threads eats up my memory and i cant do anything. However, the very strange thing is, even i shut the browser, these processes are not released at all, they are releaesd when i shut down netbeans.... no wonder i have to restart netbeans every 4-5 runs...

im very confused now, is it a netbeans's problem or my problem? whats your opinion?

any ideas are greatly appreciated!


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