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

An unhandled exception occurred

1 Answer 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tys
Top achievements
Rank 1
Tys asked on 08 Mar 2012, 11:56 AM
Our code does a small simple update on a simple object. (it only updates a date field) And, once in a 1000 times we find this error in our event log:
Can anyone say something useful about this?

An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/ROOT
Process ID: 4336
Exception: System.InvalidOperationException
Message: Collection was modified; enumeration operation may not execute.

StackTrace:    at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ConnectionImp.Close(Boolean managed)
   at OpenAccessRuntime.Relational.conn.LoggingConnection.closeRealConnection()
   at OpenAccessRuntime.Relational.conn.PooledConnection.destroy()
   at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.closeTimedOutConnectionsParallel(Int64 timeoutTicks)
   at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.RunParallel()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 13 Mar 2012, 02:42 PM
Hi Tys,

The call stack suggests that this exception is thrown from the connection pool. OpenAccess maintains a connection pool for better connection management and prriodically does some 'housekeeping' on this pool, in a background thread. Connections that are given out of the pool and are still in use for more than the allowed time (set via the 'Active Connection Timeout' seetting) are forcibly closed. While closing such timed out connections the background thread attempts to close readers that are open on this connection. It seems that there is simultaneous access to this reader in the main thread also ,maybe you are iterating the result set of a query.
We will fix this by providing better thread synchronization while closing the connection. You have a couple of ways to get over this
  1. You can increase the connection timeout value via the model settings dialog OR
  2. You can switch to ADO connection pool so that the OpenAccess connection management is switched off

 Hope this helps.

Do get back in case you need further assistance.
Your Telerik points have been updated.

Kind regards,
Ady
the Telerik team
Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Tags
General Discussions
Asked by
Tys
Top achievements
Rank 1
Answers by
Ady
Telerik team
Share this question
or