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

This SqlTransaction has completed; it is no longer usable

3 Answers 3106 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.
Bob
Top achievements
Rank 2
Bob asked on 11 May 2016, 10:09 PM

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.

3 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 12 May 2016, 02:04 PM
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.
0
Bob
Top achievements
Rank 2
answered on 12 May 2016, 03:25 PM

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?

0
Thomas
Telerik team
answered on 12 May 2016, 04:14 PM
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.
Tags
Data Access Free Edition
Asked by
Bob
Top achievements
Rank 2
Answers by
Thomas
Telerik team
Bob
Top achievements
Rank 2
Share this question
or