Exception not immediately thrown after connect failure when connectRetryCount=0
bukkfrig opened this issue · 3 comments
Driver version
Starting in 9.5.0, through current version: 12.4.1.
SQL Server version
Microsoft SQL Server 2019
Client Operating System
Windows Server 2016 Standard
JAVA/JVM version
17
Problem description
Prior to driver version 9.3.0, when we would have a connection failure (for testing, we use "Take offline" at the database), we would get a SQLServerException immediately on trying to connect, and this was the desired behaviour for our application.
After the changes in version 9.3.0 ("added Open Connection Retry"), instead we have to wait for the duration of the "loginTimeout" before getting the SQLServerException. In versions 9.3.0 through 9.4.1 we could remedy this by setting connectRetryCount=0, and again get the desired immediate SQLServerException.
However, after the changes in version 9.5.0 ("Idle Connection Resiliency Feature"), setting the connectRetryCount=0 no longer triggers an immediate exception when the database is offline.
Expected behavior
With connectRetryCount=0, an immediate exception is thrown when connecting to an offline database.
Actual behavior
With connectRetryCount = 0, exception is thrown after 30 seconds (duration of default loginTimeout) when connecting to an offline database.
Hi @bukkfrig,
We're aware of this issue and are currently working on a solution.
Retry logic was rewritten in PR 2247, which will be available in driver release 12.5.