Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active connections issues with JDK8 vs JDK6 #599

Closed
olivergg opened this issue Mar 22, 2016 · 6 comments
Closed

Active connections issues with JDK8 vs JDK6 #599

olivergg opened this issue Mar 22, 2016 · 6 comments

Comments

@olivergg
Copy link

I have a webapp with the following configuration :
HikariCP-java6 2.3.13
Hibernate 4.3.5.Final
Tomcat7 (tested on Jetty as well)

The webapp is compiled with JDK6.

When I run the webapp on a Tomcat with a JRE6, everything runs fine during the startup, meaning every now and then I've got the following messages in the log (with DEBUG enabled) :

[HikariCP connection filler (pool dataSource)] DEBUG [HikariPool] After fill pool stats dataSource (total=10, inUse=1, avail=9, waiting=0)
// later on
[Hikari Housekeeping Timer (pool dataSource)] DEBUG [HikariPool] Before cleanup pool stats dataSource (total=10, inUse=0, avail=10, waiting=0)
[Hikari Housekeeping Timer (pool dataSource)] DEBUG [HikariPool] After cleanup pool stats dataSource (total=10, inUse=0, avail=10, waiting=0)
[HikariCP connection filler (pool dataSource)] DEBUG [HikariPool] After fill pool stats dataSource (total=10, inUse=0, avail=10, waiting=0)

Now, using the exact same webapp, but using JRE8, I've got the following log :

[HikariCP connection filler (pool dataSource)] DEBUG [HikariPool] After fill pool stats dataSource (total=10, inUse=1, avail=9, waiting=0)
// later on
[Hikari Housekeeping Timer (pool dataSource)] DEBUG [HikariPool] Before cleanup pool stats dataSource (total=10, inUse=3, avail=7, waiting=0)
[Hikari Housekeeping Timer (pool dataSource)] DEBUG [HikariPool] After cleanup pool stats dataSource (total=10, inUse=3, avail=7, waiting=0)
[HikariCP connection filler (pool dataSource)] DEBUG [HikariPool] After fill pool stats dataSource (total=10, inUse=3, avail=7, waiting=0)

And the IN_USE connections are never released afterwards ....

I guess it must be related to the following comment in HikariPool.java

  /**
    * Attempt to abort() active connections on Java7+, or close() them on Java6.
    *
    * @throws InterruptedException 
    */
   @Override
   protected void abortActiveConnections(final ExecutorService assassinExecutor) throws InterruptedException
   {

Is there any way around this ?

Thanks.

@brettwooldridge
Copy link
Owner

It is unlikely to be caused by the abortActivrConnection() code, as that is only called during shutdown. I will investigate further.

@olivergg
Copy link
Author

@brettwooldridge thanks, here is some additional information that may help :

JDBC driver : 9.2-1004-jdbc4

DEBUG [HikariConfig] dataSource - configuration:
DEBUG [HikariConfig] allowPoolSuspension.............false
DEBUG [HikariConfig] autoCommit......................true
DEBUG [HikariConfig] catalog.........................null
DEBUG [HikariConfig] connectionInitSql...............null
DEBUG [HikariConfig] connectionTestQuery.............null
DEBUG [HikariConfig] connectionTimeout...............30000
DEBUG [HikariConfig] dataSource......................null
DEBUG [HikariConfig] dataSourceClassName.............null
DEBUG [HikariConfig] dataSourceJNDI..................null
DEBUG [HikariConfig] dataSourceProperties............{password=<masked>}
DEBUG [HikariConfig] driverClassName................."org.postgresql.Driver"
DEBUG [HikariConfig] healthCheckProperties...........{}
DEBUG [HikariConfig] healthCheckRegistry.............null
DEBUG [HikariConfig] idleTimeout.....................600000
DEBUG [HikariConfig] initializationFailFast..........true
DEBUG [HikariConfig] isolateInternalQueries..........false
DEBUG [HikariConfig] jdbc4ConnectionTest.............false
DEBUG [HikariConfig] jdbcUrl........................."XXXXXXXXXXXXXXXXXXXXXX"
DEBUG [HikariConfig] leakDetectionThreshold..........0
DEBUG [HikariConfig] maxLifetime.....................1800000
DEBUG [HikariConfig] maximumPoolSize.................10
DEBUG [HikariConfig] metricRegistry..................null
DEBUG [HikariConfig] metricsTrackerFactory...........null
DEBUG [HikariConfig] minimumIdle.....................10
DEBUG [HikariConfig] password........................<masked>
DEBUG [HikariConfig] poolName........................"dataSource"
DEBUG [HikariConfig] readOnly........................false
DEBUG [HikariConfig] registerMbeans..................true
DEBUG [HikariConfig] scheduledExecutorService........null
DEBUG [HikariConfig] threadFactory...................null
DEBUG [HikariConfig] transactionIsolation............null
DEBUG [HikariConfig] username........................"XXXXXXXXXXXXXXXXXXXXXX"
DEBUG [HikariConfig] validationTimeout...............5000
``

@brettwooldridge
Copy link
Owner

Can you enable leak detection via the leakDetectionThreshold? I'm curious if anything shows up.

@olivergg
Copy link
Author

Three exceptions are raised. Each time, the stacktrace is as follows :

15:19:46 [Hikari Housekeeping Timer (pool dataSource)] WARN  [LeakTask] Connection leak detection triggered for connection org.postgresql.jdbc4.Jdbc4Connection@3ddbc4a0, stack trace follows
java.lang.Exception: Apparent connection leak detected
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139)
    at org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.use42Api(AbstractUserTypeHibernateIntegrator.java:80)
    at org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.integrate(AbstractUserTypeHibernateIntegrator.java:61)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
    at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372)
....
....
...

@olivergg
Copy link
Author

I use Jadira 3.2.0.GA, I'll try to upgrade it to the latest compatible version.

@olivergg
Copy link
Author

After upgrading to 4.0.0.GA, there are no more leaks .... So the problem is solved. I've noticed you did report this problem in the release note of Jadira. Thanks for your help ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants