Share via


Destroying connection that is not valid, due to the following exception [com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset]

Question

Monday, June 13, 2011 4:17 PM

Hi everyone, 

I'm facing the following problem in a Server runing Linux with JBoss AS 4.2.2, JRE 1.6, and MSSQL Server 2005 with JDBC 2.0 (sqljdbc4.jar).

The thing is: on friday morning I started up the server and everything worked fine ... next, from Friday at 6pm to Saturday at 8am nobody has used the system. 

Then on Saturday at 8:05 got the following warning lines every time I tried to do something in my application. While it seems that everything works, after a few days the system starts to decrease their performance and malfunction, so I want to know why it might happen these warnings.

 

I have tried to find a solution to this problem in several places but I'm not succeeding. That's why I'm writing my problem here... 

Hope somebody can help me!

Thanks in advance and best regards!

Cristian.

 

 

This is the "error" log.

2011-06-11 08:05:29,680 WARN [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory] Destroying connection that is not valid, due to the following exception: ConnectionID:2941
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1352)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1339)
    at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1654)
    at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:3694)
    at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:5022)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:773)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:676)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:649)
    at org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:58)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:435)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:231)
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:200)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:211)
    at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:538)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
    at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
    at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
    at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
    at org.hibernate.loader.Loader.doQuery(Loader.java:673)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
    at org.hibernate.loader.Loader.doList(Loader.java:2220)

And this is my mssql-ds.xml

 

<local-tx-datasource>
 <jndi-name>jdbc/bpmsdb</jndi-name>
    <connection-url>jdbc:sqlserver://ipaddress:1433;DatabaseName=BPMS</connection-url>
 <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
 <user-name>user</user-name>
 <password>pwd</password>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>50</max-pool-size>
    <exception-sorter-class-name>
        org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
    </exception-sorter-class-name>
    <metadata>
     <type-mapping>MS SQLSERVER2000</type-mapping>
    </metadata>
     <new-connection-sql>select 1</new-connection-sql>
     <check-valid-connection-sql>select 1</check-valid-connection-sql>    
     <idle-timeout-minutes>5</idle-timeout-minutes>    
 </local-tx-datasource>

 

 

All replies (4)

Tuesday, June 28, 2011 10:09 PM ✅Answered

The error seems to be due to the usage of connections(probably those that were idle for some time) that are closed.

Could you please provide the corresponding jdbc traces in finest mode for further analysis?

Thanks,

Sumadhur

 


Wednesday, March 14, 2012 9:05 AM

I am facing similar problem with linux and SQL server 2008.

could anyone help out?


Thursday, March 22, 2012 5:46 PM

I´m facing similar problem with Linux and SQL Server 2008 R2. I made the downgrade of JDK 1.6 from 27 to 26 (some people reporting errors when upgraded to jdk1.6_29 and rolling back is ok) but for me the error persists. At this moment we are testing with sqljdbc4.jar version 4.0 (released in 3/6/2012). The curious I have two equals Linux boxes and only one have presented connection reset errors.

Thanks in advance.

Carlos


Thursday, July 24, 2014 5:20 PM

Hi,

Do you have any solution. we are also facing same issue with 

com.microsoft.sqlserver:sqljdbc4:1.0 with

Microsoft SQL Server 2008 R2 (SP1) on Linux environment

unwinding now
org.apache.cxf.interceptor.Fault: CallableStatementCallback; SQL [{call xxxx(?, ?)}]; Connection reset; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset