Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Commit Exception on the second commit after thread interruption
[CDO] Commit Exception on the second commit after thread interruption [message #1863579] Mon, 12 February 2024 15:18 Go to next message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
We are experiencing a strange behavior (CDO Version 4.23.0) in case of a thread interruption while setting model attributes. This only occurs in case that the transaction uses a CDOMergingConflictResolver.

It can be reproduced as follows:
* 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: (...)"

This problem was a bit difficult to track down, because the error only happens on the second commit. Is there any way to recover from this state "trying to modify a historical revision"? Committing the transaction a second time does not help. Rolling back does help, but I would like to prevent it.

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();
  }

Re: [CDO] Commit Exception on the second commit after thread interruption [message #1863885 is a reply to message #1863579] Mon, 04 March 2024 08:32 Go to previous message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
I created the following ticket:
https://github.com/eclipse-cdo/cdo/issues/42
Previous Topic:How to change the name at the runtime in eclipse emf
Next Topic:How to change name of multiple objects by changing the name of only one
Goto Forum:
  


Current Time: Thu May 02 02:50:08 GMT 2024

Powered by FUDForum. Page generated in 0.02203 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top