• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DataSource Connections not closed

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I would like to know if there is some problem with our configuration. We are using JBoss 4.0.3SP1 and AJP port fronted by apache using mod_jk. Our service.xml file looks like this:



Currently, JMX console shows following stats for ManagedConnectionPool:



What I feel abnormal is the InUseConnectionCount. It's unlikely that an application at no load uses 2252 connections. Also i think the setting connectionTimeout=20000 for AJP port is not functional, even though the server.log shows connection timed out sequences. I wonder about the difference in value of ConnectionDestroyedCount and ConnectionCreatedCount which is greater than 3000 which clearly shows that connections are not being closed properly.
Can anyone give any idea about this?
I am hopeful.

Thank You
Lochan Serma
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused. The title for your post mentions datasource connections. The service.xml file entries are for HTTP connections, not for database connections. In which case I am not exactly sure about the "stats for ManagedConnectionPool", were those for HTTP or datasource connections (it would help if you gave the full JMX mbean name.

I wonder about the difference in value of ConnectionDestroyedCount and ConnectionCreatedCount which is greater than 3000


ConnectionCreatedCount = ConnectionDestroyedCount + ConnectionCount

clearly shows that connections are not being closed properly.


If you are talking about HTTP connections, the only sane way to close them is to force your users to log out when they are done with accessing your app. The other thing you can do is lower the timeout threshold which would cause "stale" connections to be closed sooner. Of course this might also inconvenience users in one way or another, so you have to balance the user's desires with your desire to keep connections to a minimum.
 
lochan serma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,
Thank you so much for the reply and sorry for the confusion. Actually I was depicting the value connectionTimeout="20000" for the AJP port. The http port is not in use and has been commented.

Here is what the mssql-ds.xml file looks like.

<datasources>
<local-tx-datasource>
<jndi-name>DS</jndi-name>
<connection-url>jdbc:sqlserver://xxx.xxx.xxx.xxx:1433;database=abc</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<user-name>user</user-name>
<password>password</password>
<min-pool-size>500</min-pool-size>
<max-pool-size>4000</max-pool-size>
<blocking-timeout-millis>10000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>

<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>MS SQLSERVER2000</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>

We have set the max-pool-size to 4000. I was eager to know why our ConnectionCount is always rising and not resetting even when the application is idle. Since the timeout is set to 10 seconds i was thinking that the connection count should decrease as the connections are timed out. Please help me if i have misunderstood. Also the InUseConnectionCount has a value in thousands even when the application is idle. Do they increase until the AvailableConnectionCount reaches the MinSize? Shouldn't they reset after the connections are terminated?

Any help will be greatly appreciated.
Thank You
Lochan Serma
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should decrease unless you have a connection leak in your application (though the check-valid-connection-sql will use some connections fairly constantly). I would check how you close connections.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The InUseConnectionCount indicates that your code (or actually, all code using that datasource - is that datasource used by messaging or any other services or apps?) currently has that many active connections to the database. The database might be able to tell you which queries were done on each connection - that might help you understand who still is holding on to the connection.
 
lochan serma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

I used CachedConnectionManager to detect connection leaks and JBoss successfully closed open connections for me resulting very few InUseConnectionCount. However, it also closed the result sets in our application. Could you please help me set some fixed time interval after which the connections could be closed by Jboss? I could not figure out how JBoss determines which connections are totally inactive. Result Sets do need to exist for some time but i feel JBoss tries to close them immediately.

Any support on this issue would be greatly appreciated.

Thank You
Lochan
reply
    Bookmark Topic Watch Topic
  • New Topic