Unstable connection? 'Physical connection is not usable'

2 posts, 0 answers
  1. Tim
    Tim avatar
    18 posts
    Member since:
    Jul 2013

    Posted 24 Oct 2014 Link to this post

    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
  2. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 27 Oct 2014 Link to this post

    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.
     
  3. DevCraft banner
Back to Top