This is a migrated thread and some comments may be shown as answers.

Unstable connection? 'Physical connection is not usable'

1 Answer 1834 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tim
Top achievements
Rank 1
Tim asked on 24 Oct 2014, 09:08 AM
Hello,

we are experiencing this exception while connecting to an SQL Server 2012 Enterprise database:

System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
   at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
   at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
   at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
   at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at OpenAccessRuntime.CommandWrapper.ExecuteReader(CommandBehavior behavior)
   at Telerik.OpenAccess.Runtime.Logging.LoggingDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.CommandImp.ExecuteReader()
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery(Nullable`1 commandTimeout)
ClientConnectionId:32283d8f-0311-48e6-889a-aa317b84140a
-------------------------------

This exception  is popping up irregularly. Sometimes we have a few days without them, sometimes we get 2-3 exceptions during one day.

We are using OpenAccess 2014.2 918. 

I'll be glad for any answer.

Joel

1 Answer, 1 is accepted

Sort by
0
Kristian Nikolov
Telerik team
answered on 27 Oct 2014, 11:24 AM
Hello Joel,

Thank you for contacting us.

The issue you are experiencing seems to be related to a SQL Server issue where the connection to the server has been lost. For more information about the error you can check this MSDN blog post. The optimal solution to the situation would be to address the SQL Server error itself.

Should you need to handle the issue on the Telerik Data Access side, you can try implementing retry logic. Note that as the exception appears to occur when an attempt is made to execute an operation the database server side, you will have to handle the situation wherever a LINQ query causes a call to the database engine. The following code is a simple example:
List<Category> categories;
try
{
    categories = context.Categories.ToList();
}
catch (DataStoreException ex)
{
    //evalueate the exception
    if (true)
    {
        categories = context.Categories.ToList();
    }
}

I hope this helps. Should you have additional questions feel free to use our forums again.

Regards,
Kristian Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Data Access Free Edition
Asked by
Tim
Top achievements
Rank 1
Answers by
Kristian Nikolov
Telerik team
Share this question
or