Skip to content

loginTimouts overwrites socketTimeout for SELECTs #2354

@jesudornenkrone

Description

@jesudornenkrone

Driver version

12.6.0 (before 12.4.2)

SQL Server version

Microsoft SQL Server 2016 (SP3-GDR)

Client Operating System

Windows 11 23H2 and Windows Server 2012 R2

JAVA/JVM version

Java 21 and Java 17

Problem description

Using mssql-jdbc 12.4.2.jre11 everything was working as expected, but since we updated to 12.6.0.jre11 we get "java.net.SocketTimeoutException" with some long running SELECTs.

It is fairly easy to reproduce, by setting the socketTimeout to 90s and loginTimeout to 10s (i.e.: jdbc:sqlserver://192...;socketTimeout=90000;loginTimeout=10). Then we start a SELECT which takes the MSSQL Server more than 10s to return the first result.

Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:976)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1206)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:1192)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1206)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:1192)

Could this be related to this change in version 12.6.0 "Changed socketTimeout to ensure it's always less than or equal to loginTimeout #2280"?

We normally use the default 30s loginTimeout, because we want the application to fail fast, if DB is not available. But we have some slow SELECTs fo which we require a much higher socketTimeout.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in the driver. A high priority item that one can expect to be addressed quickly.

    Type

    No type

    Projects

    Status

    Closed Issues

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions