Reproducible with CDO Version 4.23.0.
If an interrupted thread makes changes to the model, then we can run into the following problem.
I can only reliably reproduce this problem when using a CDOMergingConflictResolver. But I think that it also happened (rarely) if no conflict resolver was in place.
Steps to reproduce the problem (also check code below)
- Open an object in a transaction
- Modify the object in a thread which is interrupted (which throws an exception, which is fine)
- Commit the transaction in the original thread => everything looks good, also the value is correct
- Modify the object again and commit it => Unexpected commit exception: "Attempt by Transaction[2:1] to modify historical revisions: (...)"
It can be reproduced with the following code:
public void testCase() throws Exception
{
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
transaction.options().addConflictResolver(new CDOMergingConflictResolver());
OrderDetail orderDetail = getModel1Factory().createOrderDetail();
orderDetail.setPrice(1);
CDOResource resource = transaction.createResource(getResourcePath("/test1"));
resource.getContents().add(orderDetail);
transaction.commit();
Thread t = new Thread(() -> {
Thread.currentThread().interrupt();
orderDetail.setPrice(2);
});
t.start();
t.join();
transaction.commit();
orderDetail.setPrice(3);
transaction.commit(); // <<<< exception
}
Reproducible with CDO Version 4.23.0.
If an interrupted thread makes changes to the model, then we can run into the following problem.
I can only reliably reproduce this problem when using a CDOMergingConflictResolver. But I think that it also happened (rarely) if no conflict resolver was in place.
Steps to reproduce the problem (also check code below)
It can be reproduced with the following code: