This SqlTransaction has completed; it is no longer usable

4 posts, 0 answers
  1. Bob
    Bob avatar
    10 posts
    Member since:
    Apr 2014

    Posted 11 May Link to this post

    Recently our website has begun getting an error, seemingly randomly, when calling the SaveChanges() method:

    Exception: Telerik.OpenAccess.OpenAccessException: System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ConnectionImp.commit()
       at OpenAccessRuntime.Relational.conn.PsPoolConnection.commit()
       at OpenAccessRuntime.Relational.conn.PooledConnection.commit()
       at OpenAccessRuntime.Relational.RelationalStorageManager.commitAndReleaseCon(Boolean commit)
       at OpenAccessRuntime.Relational.RelationalStorageManager.store(StatesToStore toStore, DeletePacket toDelete, Boolean returnFieldsUpdatedBySM, Int32 storeOption, Boolean evictClasses)
       at OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.store(StatesToStore toStore, DeletePacket toDelete, Boolean returnFieldsUpdatedBySM, Int32 storeOption, Boolean evictClasses) ---> System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ConnectionImp.commit()
       at OpenAccessRuntime.Relational.conn.PsPoolConnection.commit()
       at OpenAccessRuntime.Relational.conn.PooledConnection.commit()
       at OpenAccessRuntime.Relational.RelationalStorageManager.commitAndReleaseCon(Boolean commit)
       at OpenAccessRuntime.Relational.RelationalStorageManager.store(StatesToStore toStore, DeletePacket toDelete, Boolean returnFieldsUpdatedBySM, Int32 storeOption, Boolean evictClasses)
       at OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.store(StatesToStore toStore, DeletePacket toDelete, Boolean returnFieldsUpdatedBySM, Int32 storeOption, Boolean evictClasses)
       --- End of inner exception stack trace ---
       at OpenAccessRuntime.ExceptionWrapper.Throw()
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x, Boolean needsRollback)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
       at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.commit()
       at OpenAccessRuntime.EnlistableObjectScope.CommitChanges()
       at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges(ConcurrencyConflictsProcessingMode failureMode)

    Has anyone else come across this?  When Googling this error, it seems this error stems from closing the connection then attempting to make another transaction call, but Data Access is handling all of this.

  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 12 May Link to this post

    Hello Bob,

    because another customer recently reported a similar issue we would like to know what has changed in your setup that could have caused such a change in behavior. Did you apply framework changes or SQL server changes? We have a lot of applications that call SaveChanges(), but had not come across such an issue so far. Any related information could be of help!

    Thanks & Regards,
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
  4. Bob
    Bob avatar
    10 posts
    Member since:
    Apr 2014

    Posted 12 May in reply to Thomas Link to this post

    Thomas,

    Sadly, nothing has changed on our framework or SQL Server database.

    This doesn't happen all of the time and has only happened three times over the last couple days out of thousands of transactions we get a day, but they have been three rather crucial transactions in our business logic.

    Could this be some sort of timeout issue?  Where is the timeout being set?

  5. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 12 May Link to this post

    Hi Bob,

    it could if you use our internal connection pool which also has an active side to terminate transactions IFF they are long-running, thus blocking database server resources.

    You might want to add something like

    using Telerik.OpenAccess;
     
    static partial void CustomizeBackendConfiguration(ref BackendConfiguration config)
            {
                config.ConnectionPool.ActiveConnectionTimeout = 600;
            }

    to your configuration. The standard value is 120 seconds, two minutes; that should usually be plenty enough.

    Regards,
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top