Hang when acquiring connection on Java 11
See original GitHub issueDriver 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:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
It would appear that the issue is no longer reproducible with OpenJDK build
11+27
. Originally I had discovered this while testing with11-ea+25
and11-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.
@sddakoty — any luck?