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.

Hang when acquiring connection on Java 11

See original GitHub issue

Driver version or jar name

mssql-jdbc-7.0.0.jre10.jar

SQL Server version

Microsoft SQL Server 14.00.3035

Client operating system

Ubuntu 18.04.1

Java/JVM version

$ ./java -version
openjdk version "11-ea" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11-ea+26)
OpenJDK 64-Bit Server VM 18.9 (build 11-ea+26, mixed mode)

Table schema

No tables have been created in the DB yet.

Problem description

Driver hangs when we try to acquire a connection to the Database. The issue only occurs on Java 11. On Java 10 things work fine. I realize Java 11 is not officially supported yet, but this is something that will likely have to be addressed in order to add support for it.

Thread dumps of hung JVMs show that the stack eventually settles on something like this:

   java.lang.Thread.State: RUNNABLE
        at java.lang.Throwable.fillInStackTrace(java.base@11-ea/Native Method)
        at java.lang.Throwable.fillInStackTrace(java.base@11-ea/Throwable.java:787)
        - locked <0x000000043c2f08b0> (a java.io.EOFException)
        at java.lang.Throwable.<init>(java.base@11-ea/Throwable.java:270)
        at java.lang.Exception.<init>(java.base@11-ea/Exception.java:66)
        at java.io.IOException.<init>(java.base@11-ea/IOException.java:58)
        at java.io.EOFException.<init>(java.base@11-ea/EOFException.java:62)
        at sun.security.ssl.SSLSocketInputRecord.decode(java.base@11-ea/SSLSocketInputRecord.java:169)
        at sun.security.ssl.SSLTransport.decode(java.base@11-ea/SSLTransport.java:108)
        at sun.security.ssl.SSLSocketImpl.decode(java.base@11-ea/SSLSocketImpl.java:877)
        at sun.security.ssl.SSLSocketImpl.waitForClose(java.base@11-ea/SSLSocketImpl.java:952)
        at sun.security.ssl.SSLSocketImpl.closeSocket(java.base@11-ea/SSLSocketImpl.java:929)
        at sun.security.ssl.SSLSocketImpl.shutdown(java.base@11-ea/SSLSocketImpl.java:1170)
        at sun.security.ssl.TransportContext.initiateOutboundClose(java.base@11-ea/TransportContext.java:567)
        at sun.security.ssl.TransportContext.closeOutbound(java.base@11-ea/TransportContext.java:482)
        at sun.security.ssl.TransportContext.close(java.base@11-ea/TransportContext.java:450)
        at sun.security.ssl.SSLSocketImpl.close(java.base@11-ea/SSLSocketImpl.java:447)
        - locked <0x0000000442811460> (a sun.security.ssl.SSLSocketImpl)
        at com.microsoft.sqlserver.jdbc.TDSChannel.disableSSL(IOBuffer.java:718)
        at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:4015)
        at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:3128)
        at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7602)
        at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7590)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4771)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3581)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:81)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3541)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869)
        - locked <0x00000004428126e8> (a java.lang.Object)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2395)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2042)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1889)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1120)
        at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:700)
        at com.pega.pegarules.util.deploy.JDBCUtils$ClassLoaderDriverProxy.connect(JDBCUtils.java:56)
        at java.sql.DriverManager.getConnection(java.sql@11-ea/DriverManager.java:677)
        at java.sql.DriverManager.getConnection(java.sql@11-ea/DriverManager.java:189)

Expected behavior and actual behavior

Expected behavior: A connection is acquired successfully without hang. Actual behavior: The driver hangs during the call to get connection and never returns.

Repro code

Can reproduce simply with the below line of code (with <host>, <port>, and <dbname> replaced with values appropriate for your environment).

DriverManager.getConnection("jdbc:sqlserver://<host>:<port>;databaseName=<dbname>;selectMethod=cursor;sendStringParametersAsUnicode=false", new Properties());

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
pega-roskacommented, Aug 23, 2018

It would appear that the issue is no longer reproducible with OpenJDK build 11+27. Originally I had discovered this while testing with 11-ea+25 and 11-ea+26.

Since it would seem this is a bug that has already been fixed in OpenJDK itself, it doesn’t seem that there needs to be any action taken here at this time.

0reactions
dmn-cccommented, Mar 8, 2019

@sddakoty — any luck?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hang when acquiring connection on Java 11 #784 - GitHub
Driver hangs when we try to acquire a connection to the Database. The issue only occurs on Java 11. On Java 10 things...
Read more >
JDBC Connection Hangs in the webapp - Oracle Communities
Hi All, I have a webapp using Oracle JDBC thin driver to connect to Oracle 8.1.7 Database. This app has been running for...
Read more >
Acquired Connections grows abruptly leading to server crash
The number of acquired connections keeps on incrementing and the Glassfish 4 crashes after around 10 days with below exception.
Read more >
How to resolve connection issues in JDBC to Oracle (2 ...
This connection reset error was caused by an incompatibility between the Oracle server and the JDBC driver used. Issue 2: The connection was...
Read more >
PM91941: THREADS HANG IN SOCKETREAD() WHEN ... - IBM
When the number of connections held with the hung threads is high, the connection pool can get exhausted quickly and the applications new...
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