I am using Spring 3.0.5.RELEASE and Postgres 9.1.
I am limiting a maximum number of connections in 17:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${database.driver}" />
<property name="jdbcUrl" value="${database.url}" />
<property name="user" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="initialPoolSize" value="3" />
<property name="minPoolSize" value="1" />
<property name="maxPoolSize" value="17" />
</bean>
When my application gets to occupy all the connections, it just hangs, and doesn’t cancel or accept more transactions. All processes in Postgres are in state “idle in transaction”.
Thank you!
The symptoms you describe are consistent with your application’s leaking Connections. That is, your application is checking out Connections, but failing to check them back in [that is, failing to call close()].
Are you consistently using the robust resource cleanup idiom? See e.g
http://old.nabble.com/Re:-My-connections-are-all-idle…-p27691635.html
As suggested in that link, try temporarily setting an unreturnedConnectionTimeout and using
debugUnreturnedConnectionStackTraces to track down the leak. See
http://www.mchange.com/projects/c3p0/index.html#unreturnedConnectionTimeout
http://www.mchange.com/projects/c3p0/index.html#debugUnreturnedConnectionStackTraces
I hope this helps!