Collection was modified; enumeration operation may not execu

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
EricDahlvang
Posts: 4
Joined: Wed 21 Jul 2010 15:51

Collection was modified; enumeration operation may not execu

Post by EricDahlvang » Mon 02 Aug 2010 05:03

at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at Devart.Data.PostgreSql.s.a(ae A_0)
at Devart.Data.PostgreSql.ae.d(Boolean A_0)
at Devart.Data.PostgreSql.ae.h()
at Devart.Data.PostgreSql.PgSqlDataReader.Close()
at Devart.Common.DbCommandBase.ExecuteNonQuery()

Connection String=
Server=localhost;Port=5432;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;Unicode=True;User Id=xxx;Password=xxx;Database=xxx

The occurrence of this exception is inconsistent. We are adding hundreds of thousands of records, and committing every 1000...closing and reopening the connection at the same time. After a couple hundred thousand, this exception will randomly occur.

We are using version 4.95.152.


I've noticed that there have been numerous bug fixes in your postgresql codebase in the past couple of months. Are you certain this is production ready?

We have been struggling with this exception and the one here: http://www.devart.com/forums/viewtopic. ... 9038#59038 (we were unable to produce a repro case, although we consistently got this in our codebase, and abandoned your linq provider because of it...moving everything into commands). Now, we are randomly getting this "collection was modified" exception.

I assure you, we are not doing anything out of the ordinary in our code. Just creating and executing commands. We do not have time to work on reproducing these errors in a side project. We are considering moving to Npgsql.

Do you have any suggestions?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 04 Aug 2010 09:25

It seems like the problem occurs when our code tries to access an item from collection but this item is already removed from this collection:
1) make sure that the same connection object in your code is not used in several threads simultaneously;
2) we have implemented some changes in our code. Please contact us via contact form to give us your license number (or confirm that you are using trial - usual or extended?), your edition, valid e-mail address. We will send you special build to check if it fixes the issue.

We are investigating the situation when this error can arise.

EricDahlvang
Posts: 4
Joined: Wed 21 Jul 2010 15:51

We have switched to another product

Post by EricDahlvang » Wed 04 Aug 2010 19:03

We have already switched to another product, and would like a refund. Here is our share-it! order number: 331150455

EricDahlvang
Posts: 4
Joined: Wed 21 Jul 2010 15:51

For your debugging use

Post by EricDahlvang » Wed 04 Aug 2010 19:09

Shalex wrote:make sure that the same connection object in your code is not used in several threads simultaneously;
As I had stated in the other forum post:

"This exception occurs within the execution path of a single thread....In our current code, we create a data context at the beginning of an operation, and dispose of it when we commit the transaction. We create and destroy multiple data contexts for the duration of the operation. However, we only have one active data context on a thread at any given time, and a thread only ever uses that one data context."

We had tied the data context to the thread id. I don't know how you are implementing threads in your code base, but I've wondered if this is related to some managed/unmanged thread issue. I assure you, we were only using a single data context on a thread at a time. Both the Array List exception, and the GCHandle exception were encountered in code that used one data context per thread at a time.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 05 Aug 2010 12:25

1. Could you please contact us via contact form to give us your license number (use the e-mail you have registered in our customer base), your edition, valid e-mail address that will not reject attachments. We will send you a special build to check if it fixes the Array List issue.

2. If the problem is not solved, please contact our sales department (sales at devart*com) about refund.

Post Reply