BIMserver icon indicating copy to clipboard operation
BIMserver copied to clipboard

BimserverConcurrentModificationDatabaseException when creating and deleting an object in one transaction

Open dkurillo opened this issue 2 years ago • 3 comments

When I create an object and then remove it in the same transaction I get BimserverConcurrentModificationDatabaseException. This is due to the fact that this object is located both in created and deleted object lists.

The workaround for this issue would be adding the following lines of code in RemoveObjectChange class:

// new lines of code start here
if (transaction.getCreated().contains(object)) {
    transaction.getCreated().remove(object);
}
if (transaction.getUpdated().contains(object)) {
   transaction.getUpdated().remove(object);
}
// end here

transaction.deleted(object);

dkurillo avatar Mar 22 '22 09:03 dkurillo

When I try and reproduce with Web Console, I don't see the exception, just the final org.bimserver.BimserverDatabaseException: Too many conflicts, tried 10 times. Maybe it's my logging settings. How are you creating changes and committing transactions? Do you see this as a user exception on the client side or just in the server log?

Not sure if the transaction should be "fixed" or conflicts resolved that way. There could be other follow-up issues like references created to the object which is removed in the transaction. However, I think, reporting of conflicting transactions and roll-back in those cases deserve a review. I tried the following critical cases: 1. create and remove object, 2. modify attribute and remove object, 3. remove referenced object. In the latter case, it seems that object is removed, but no revision created and subsequent commits fail (until the referencing object is removed as well or reference unset) - no matter whether they touch the removed object.

hlg avatar Mar 25 '22 10:03 hlg

When I try and reproduce with Web Console, I don't see the exception, just the final org.bimserver.BimserverDatabaseException: Too many conflicts, tried 10 times. Maybe it's my logging settings. How are you creating changes and committing transactions? Do you see this as a user exception on the client side or just in the server log?

That's right. I also see "Too many conflicts, tried 10 times" but under the hood it's the BimserverConcurrentModificationDatabaseException.

Not sure if the transaction should be "fixed" or conflicts resolved that way. There could be other follow-up issues like references created to the object which is removed in the transaction.

Agreed. But I made clean-up of references manually and don't expect any side effects and fails during transaction commit...

dkurillo avatar Mar 25 '22 14:03 dkurillo

And I have so error then I deleted object.

Tristamoff avatar Jun 19 '23 05:06 Tristamoff