An unhandled exception occurred

2 posts, 0 answers
  1. Tys
    Tys avatar
    14 posts
    Member since:
    Jul 2011

    Posted 08 Mar 2012 Link to this post

    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()
  2. Ady
    Ady avatar
    589 posts

    Posted 13 Mar 2012 Link to this post

    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,
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Back to Top