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.

Expired token exception after upgrade to 11.2.0.jre11

See original GitHub issue

Versions

Driver version: JDBC driver version: 11.2.0.jre11 (com.microsoft.sqlserver:mssql-jdbc:11.2.0.jre11)

SQL Server version: Microsoft SQL Azure (RTM) - 12.0.2000.8 Aug 10 2022 15:14:09 Copyright © 2022 Microsoft Corporation

Client Operating System: Linux on Azure App Service, single instance Docker base image: eclipse-temurin:11-jre-alpine

JAVA/JVM version: Java 11

Java Spring: 2.7.2

JDBC connection string: jdbc:sqlserver://<db-server-name>.database.windows.net:1433;database=<db-name>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;Authentication=ActiveDirectoryMSI;

Problem description

Since we upgraded from 9.4.1.jre11 to 11.2.0.jre11 some days ago, we get failures periodically.

We updated 4 Microservices and all of them show the new bevhaviour: They are mostly working normally, but after some time (sometimes around a day), the one or more connection from the pool fail for around an hour (which generates around 80 exceptions in that time).

For example, we had the behaviour twice for the last 3 days (only a single service shown):

failures

Exception

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:83) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:330) … Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:696) at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:197) at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:162) at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128) at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:159) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:117) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) … 119 more Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ‘<token-identified principal>’. Token is expired. ClientConnectionId:<uuid> at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:300) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:133) …

We think the JDBC token renewal process was changed with the newer version, but we don’t know what exactly causes the exception. We read somewhere that Azure does a health check on active connections every now and then (10 hours?) but we do not see why this should now fail when it was working before.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Jeffery-Wastycommented, Aug 31, 2022

Hi @akleemans,

This seems to be very similar to another ongoing issue of ours, also with Hikari. Can you send us the configuration used in Hikari? I think ‘maximum-pool-size’ is what we’re most concerned with now, but all the information you can send will be helpful. Additionally, is your application taking advantage of Idle Connection Resiliency? Finally, can you please try running with these custom jars, and sending us the resulting logs. They have custom logging that should provide more insight around token expiry. If this is a token issue, this may help as well.

Custom_Logging_Jars.zip

0reactions
Jeffery-Wastycommented, Sep 13, 2022

Hi @akleemans,

Just wanted to check in and see whether the issue persists, and whether you have tried any of the solutions described above. If there is no further reply, we’ll mark the issue as closed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release notes - JDBC Driver for SQL Server - Microsoft Learn
Exception is not thrown as expected when the session is killed in SQL database, Added check for DONE_ERROR status token which may occur...
Read more >
Index (Microsoft JDBC Driver for SQL Server 9.3.0 API) - Javadoc.io
Makes all changes made since the previous commit/rollback permanent and releases any database ... Returns the acesss token of the authentication request.
Read more >
com.microsoft.sqlserver.jdbc.SQLServerConnection Maven ...
com.microsoft.sqlserver.jdbc.SQLServerConnection maven / gradle build tool code. The class is part of the package ➦ Group: com.microsoft.sqlserver ...
Read more >
TIBCO® MDM Installation and Configuration Guide
Example To listen space for Put Take Expire Seed Unseed activity . ... jdbc-7.2.2.jre11.jar ... The following exception is displayed in.
Read more >
Manjaro Linux - DistroWatch.com
Last Update: 2022-12-14 15:50 UTC ... haskell-crypto-token-0.0.1-15-x86_64.pkg.tar.zst ... haskell-enclosed-exceptions-1.0.3-221-x86_64.pkg.tar.zst
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