Skip to content

NullPointerException on reconnect with lockTimeout configured #2353

@HeinzHuberRsg

Description

@HeinzHuberRsg

Driver version

10.2.3 - 12.6.0

SQL Server version

2019

Client Operating System

Windows, Linux

JAVA/JVM version

1.8.0, 17

Table schema

No special schema

Problem description

If an automatic reconnect is triggered and lockTimeout is configured, a NullPointerException is thrown.

Expected behavior

Automatic reconnect works.

Actual behavior

Reconnect fails.

Error message/stack trace

Exception in thread "Thread-0" java.lang.NullPointerException: Cannot invoke "com.microsoft.sqlserver.jdbc.ICounter.increaseCounter(long)" because the return value of "com.microsoft.sqlserver.jdbc.TDSCommand.getCounter()" is null
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:6880)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:8077)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:8040)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$1ConnectionCommand.doExecute(SQLServerConnection.java:4260)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7675)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeReconnectCommand(SQLServerConnection.java:4222)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(SQLServerConnection.java:4266)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:5163)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:5087)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7675)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeReconnect(SQLServerConnection.java:3590)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3571)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:3172)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:3018)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1836)
at com.microsoft.sqlserver.jdbc.ReconnectThread.run(IdleConnectionResiliency.java:461)

Any other details that can be helpful

JDBC trace logs

jdbc0.zip
The support case 2402210030004759 contains an app to reproduce the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Closed Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions