-
Notifications
You must be signed in to change notification settings - Fork 426
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
lockTimeout doesn't work if applications run on Azure environment #2110
Comments
Hi @nanahoshi, Thank you for bringing this to our attention. We'll take a look into this to see what changes are needed. |
@Jeffery-Wasty withinAzure.log In contrast, the following logs are output in outsideAzure.log.
|
Looking over what we have, we explicitly check for if we have been routed before sending lockTimeout. The logic being: if we got routed in the current attempt, the server closes the connection. In that case, we shouldn't be sending any further commands to the server. So, the current behavior is intentional. We'll need to discuss this to see if we still want to address lockTimeout, even in the case of a redirect. |
Hi @Jeffery-Wasty I try to control the current bug with HikariCP's connectionInitSql (set lock_timeout 5000), but I would be happy to control it on the JDBC side. |
I'm sorry that I took a miss operation and re-open it. |
Driver version
12.2.0.jre11
SQL Server version
Microsoft SQL Azure (RTM) - 12.0.2000.8
Mar 8 2023 17:58:50
Copyright (C) 2022 Microsoft Corporation
Client Operating System
Ubuntu 18.04 LTS
Ubuntu 20.04 LTS
JAVA/JVM version
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment Microsoft-7208460 (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM Microsoft-7208460 (build 11.0.18+10-LTS, mixed mode)
Table schema
N/A
Problem description
The behaviour of 'lockTimeout' is NOT the same on 'from within Azure' and 'from outside Azure'.
From within Azure / connection policy = redirect
ref: https://learn.microsoft.com/en-us/azure/azure-sql/database/connectivity-architecture?view=azuresql#connectivity-from-within-azure
The 'lockTimeout' is ignored.
Outside Azure / connection policy = proxy
ref: https://learn.microsoft.com/en-us/azure/azure-sql/database/connectivity-architecture?view=azuresql#connectivity-from-outside-of-azure
The 'lockTimeout' is applied.
We use the below connection string on both sides.
jdbc:sqlserver://<dummy>.database.windows.net:1433;database=<dummy>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;user=<dummy>;password=<dummy>;lockTimeout=5000;
I'm not sure if the other options are applied or not.
Expected behavior
Even if the connection policy is redirect mode, JDBC shall send a packet
set lock_timeout 5000
.below query returns '5000'
Actual behavior
If the connection policy is redirect mode, JDBC doesn't send the packet
set lock_timeout 5000
.below query returns '-1'
Error message/stack trace
N/A
Any other details that can be helpful
I tested it with simple class
JDBC trace logs
Provide the JDBC driver trace logs. Instructions can be found here: https://docs.microsoft.com/sql/connect/jdbc/tracing-driver-operation
The text was updated successfully, but these errors were encountered: