B4J Question Error: Collection was modified; enumeration operation may not execute

Jorge M A

Well-Known Member
Licensed User
Hello Everyone!

This message appears spontaneously, 4 or 5 times during my process, and disappears shortly.


It's about reading a table in SQLite, of about 1 million records in batches of 20,000 each time, in one cycle.
With each batch, a collection of json objects is built. (I actually use DBUtils.ExecuteJSON), and this package is sent to a REST API, which returns the same collection of "processed" data which I invoke with "Wait For (j) JobDone".
Within JobDone, for each result I retrieve the fields in a map and insert the record in another table of the same db, using a transaction for each thousand records inserted.

At some point in the process the error appears, but it continues.

It ends with an OutOfMemory error, which I will try to resolve after knowing what happens with this message.

I have no idea what it means, how to trace the message or where it happens, so I can't publish any relevant code either.

By the way, there's no error in the Log.

I would appreciate any guidance or explanation about this message.

Thank you!


Well-Known Member
Licensed User
The error is not a java error (it looks like a C# error) it's being generated by the IDE itself.

Probably one for @Erel to investigate.

Does it run ok in release mode ?

Jorge M A

Well-Known Member
Licensed User
First I must say that my code had an error, which did not increase the number of records inserted, so the transaction was made one by one and not in lots as planned.

This meant that thousands of messages were sent to the log in a short time.

Now it' s running in Release mode, no surprises.

When exactly does it happen?
It's a hard question to answer, but I have the feeling (just guessing) that it was related to the stack of messages in the log, scrolling up and down, clicking on one of them to copy. (Maybe this entry would be blocked and it was not possible to update it with the new message.... I don't know.)

In case some eventuality happens again, now I know how to enable the IDE's log!

Many thanks to both of you.