phoenix
phoenix

Reputation: 995

Hikaricp Timer already cancelled

I have an application that uses Hikaricp to create a data source and connect to database. I have used the following defaults of Hikaricp.

#Default properties for HikariCp
hikari.maximumPoolSize=100
hikari.maxLifetime=3600000
hikari.minimumIdle=1
hikari.connectionTimeout=1800000
hikari.testQuery=SELECT 1

The data source is created with the database details when there is a request for a connection. And once the data source is created, its reference is cached and used for subsequent database interactions(as data sources need not be created time and again).

Usually I am not facing any issues. But, sometimes facing this Timer already cancelled issues. In this case the database is postgresql. The following is the stacktrace.

Caused by: java.lang.IllegalStateException: Timer already cancelled.
    at java.util.Timer.sched(Timer.java:397)
    at java.util.Timer.schedule(Timer.java:193)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.addTimerTask(AbstractJdbc2Connection.java:1357)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.startTimer(AbstractJdbc2Statement.java:3478)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:615)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:452)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:332)
    at com.zaxxer.hikari.pool.HikariPool.isConnectionAlive(HikariPool.java:132)
    at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:208)
    at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:183)
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:133)
    at com.mycompany.efwd.jdbc.DataSourceConnectionProvider.a(SourceFile:84)
    at com.mycompany.efwd.jdbc.DataSourceConnectionProvider.b(SourceFile:65)
    ... 99 more

Can someone throw light on why is this issue and how can I resolve?

Upvotes: 1

Views: 2658

Answers (1)

nbv2222
nbv2222

Reputation: 31

It is probably because you use opentracing. Just remove opentracing from your dependencies. It is the best way I find for me.

Upvotes: 3

Related Questions