question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hikari + MSSQL 7.2.1 having issues

See original GitHub issue

Hello 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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
xhumanoidcommented, Apr 22, 2019

It is because you have not thread-safe implementation of SharedTimer introduced in #920

public static synchronized SharedTimer getTimer() use lock on class instance public synchronized void removeRef() use lock on timer object instance

so possible situation when

  1. first thread start removeRef, shutdown executer and execute executor = null;
  2. second thread receive the same object over getTimer and execute schedule, but timer almost finished/shutdowned

refCount also updated in lines 63 and 84 without any memory barriers or synchronization, so nobody can guaranty what the final result will be =)

0reactions
cheenamalhotracommented, Apr 24, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft SQL repository :: IDM 7.2.1 - ForgeRock Backstage
Install Microsoft SQL Server: On the Installation has completed successfully! page of the installer, click Customize to launch the SQL Server Setup application....
Read more >
Setting the connection properties - JDBC Driver for SQL Server
The connection string properties for the Microsoft JDBC Driver for SQL Server can be specified in various ways.
Read more >
Issues with Setting Up Database Connection
We are having issues with getting the Adaptavist Resources setup for one of our database connections and are unsure of how to resolve....
Read more >
Problems with DB type Ms-Sql Server 2008 and JDBC ...
Hi, When I try to set up “JDBC Datasource in: application” and “Database type: Ms Sql Server 2008” on Main Data Store option...
Read more >
JDBC connection failed, error: TCP/IP connection to host failed
0.1, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found