Hikari + MSSQL 7.2.1 having issues
See original GitHub issueHello All,
We have an spring boot application that is using HikariCP and mssql 6.x libraries and everything seems working fine.
We started moving to the latest version of mssql, which is 7.2.1 and started observing issues connecting to the database, once in a while under load test.
On the initial research, we found that the SharedTimer thingy that got introduced is killing us.
2019-04-17_00:27:40.315 [42122f1e7f861f55:42122f1e7f861f55:0] [Root=1-5cb672fb-8a9936f01f1e83407ebf0024] [qtp1673605040-61] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-278 - Exception during pool initialization. java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@746dc536 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@7dd4eba[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830) at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:326) at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:533) at com.microsoft.sqlserver.jdbc.SharedTimer.schedule(SharedTimer.java:102)
Any help on how to fix is highly appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
It is because you have not thread-safe implementation of SharedTimer introduced in #920
public static synchronized SharedTimer getTimer()
use lock on class instancepublic synchronized void removeRef()
use lock on timer object instanceso possible situation when
executor = null;
schedule
, but timer almost finished/shutdownedrefCount also updated in lines 63 and 84 without any memory barriers or synchronization, so nobody can guaranty what the final result will be =)
Hi @TheHydGuy @xhumanoid
I’ve created PR #1046 to address thread safety issues as discussed here, please take a look and let me know if I missed something.