• Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Medium Medium
    • None
    • 5.8.17
    • None

      It seems that there is a bug in the jTDS driver within Confluence, related to SSL connections to SQL Server, see here:

      http://sourceforge.net/p/jtds/bugs/725/

      Similar bug report for JIRA: https://jira.atlassian.com/browse/JRA-39866

      Problem

      Confluence attempting to connect to SQL Server over SSL results in Network error IOException: Connection reset.

      If upgrading from a version of Confluence using Java 1.7, Confluence will not start up after the upgrade and the following appears in atlassian-confluence.log:

      2015-11-24 16:14:38,738 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] [mchange.v2.resourcepool.BasicResourcePool] run com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6478f87d -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
      java.sql.SQLException: Network error IOException: Connection reset
      	at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:385)
      	at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
      	at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
      	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
      	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
      	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
      	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
      	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
      	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
      	at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
      	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
      Caused by: java.net.SocketException: Connection reset
      	at java.net.SocketInputStream.read(SocketInputStream.java:209)
      	at java.net.SocketInputStream.read(SocketInputStream.java:141)
      	at net.sourceforge.jtds.ssl.TdsTlsInputStream.readFully(TdsTlsInputStream.java:131)
      	at net.sourceforge.jtds.ssl.TdsTlsInputStream.primeBuffer(TdsTlsInputStream.java:100)
      	at net.sourceforge.jtds.ssl.TdsTlsInputStream.read(TdsTlsInputStream.java:78)
      	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
      	at sun.security.ssl.InputRecord.read(InputRecord.java:503)
      	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
      	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
      	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
      	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
      	at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:102)
      	at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:336)
      	at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:547)
      	at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:338)
      	... 10 more
      2015-11-24 16:14:38,743 WARN [localhost-startStop-1] [sf.hibernate.cfg.SettingsFactory] buildSettings Could not obtain connection metadata
      java.sql.SQLException: Connections could not be acquired from the underlying database!
      	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
      	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
      	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
      	at net.sf.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
      	at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
      	at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1191)
      	at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:822)
      	at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:540)
      	at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:474)
      	at

      Environment

      • Java 1.8
      • SSL connection specified in db connection string: ";ssl=true"
      • Confluence is using jtds driver

      Steps to Reproduce

      1. Install Confluence 5.8.17 using the embedded JRE (1.8)
      2. Use the default jtds driver installed with Confluence
      3. Attempt to connect to a database with a secure connection - adding ;ssl=true to the database connection string.

      Workaround

            [CONFSERVER-40046] Java 1.8 and jTDS Sql Server SSL Connection Issues

              Unassigned Unassigned
              jbennett@atlassian.com J van Leeuwen
              Affected customers:
              1 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: