Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Multi-threaded access and CommitConflicts(CommitConflictException even though the CDOMergingConflictResolver is used)
[CDO] Multi-threaded access and CommitConflicts [message #1701162] Thu, 09 July 2015 15:13 Go to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
Hi,

let's consider the following setup:
- From two different threads I am modifying the same object but different attributes.
- In timeintervals of 200ms to 1000ms each thread modifies the object
- The threads open a transaction, add a CDOMergingConflictResolver, modify the object, commit and close the transaction again.

The conflict handling works correct when I added some timeout in one thread before commiting.

The problem: in rare occasions I get a CommitConflictException. This is the stacktrace:

2015-07-09T14:51:12Z	ERROR	org.eclipse.emf.cdo.util.CommitConflictException: Attempt by Transaction[2:84] to modify historical revision: CDORevisionDelta[A@OID6578:0v543 --> [CDOFeatureDelta[a, SET, value=1, oldValue=UNSPECIFIED], CDOFeatureDelta[b, SET, value=2, oldValue=UNSPECIFIED], CDOFeatureDelta[x, SET, value=true, oldValue=UNSPECIFIED]]]
org.eclipse.emf.cdo.util.CommitConflictException: Attempt by Transaction[2:84] to modify historical revision: CDORevisionDelta[A@OID6578:0v543 --> [CDOFeatureDelta[a, SET, value=1, oldValue=UNSPECIFIED], CDOFeatureDelta[b, SET, value=2, oldValue=UNSPECIFIED], CDOFeatureDelta[x, SET, value=true, oldValue=UNSPECIFIED]]]
	at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:77)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commitSynced(CDOTransactionImpl.java:1237)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1206)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1198)
	at testpackage.Class1.perform1(Class1.java:75)
	at testpackage.MyRunnable.run(MyRunnable.java:52)
	at java.lang.Thread.run(Unknown Source)


I am a bit puzzled by this exception:

1. It is thrown before CDOMergingConflictResolver.resolveConflicts(Set<CDOObject> conflicts) is called
2. From the exception: "oldValue=UNSPECIFIED". The value should never be unspecified according to my code.

Thanks for any help!
Re: [CDO] Multi-threaded access and CommitConflicts [message #1701169 is a reply to message #1701162] Thu, 09 July 2015 15:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6450
Registered: July 2009
Senior Member
Hi Alexander,

The CDOMergingConflictResolver relies on asynchronous commit notifications and commits optimistically itself. That
doesn't work well with high frequency remote changes. At many times the conflict resolver thinks it has the latest
"picture" of the server state, but it doesn't. I would try to use explicit locks on the objects that are changed with
high frequency.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 09.07.2015 um 17:13 schrieb Alexander Klatt:
> Hi,
>
> let's consider the following setup:
> - From two different threads I am modifying the same object but different attributes.
> - In timeintervals of 200ms to 1000ms each thread modifies the object
> - The threads open a transaction, add a CDOMergingConflictResolver, modify the object, commit and close the
> transaction again.
>
> The conflict handling works correct when I added some timeout in one thread before commiting.
>
> The problem: in rare occasions I get a CommitConflictException. This is the stacktrace:
>
>
> 2015-07-09T14:51:12Z ERROR org.eclipse.emf.cdo.util.CommitConflictException: Attempt by Transaction[2:84] to modify
> historical revision: CDORevisionDelta[A@OID6578:0v543 --> [CDOFeatureDelta[a, SET, value=1, oldValue=UNSPECIFIED],
> CDOFeatureDelta[b, SET, value=2, oldValue=UNSPECIFIED], CDOFeatureDelta[x, SET, value=true, oldValue=UNSPECIFIED]]]
> org.eclipse.emf.cdo.util.CommitConflictException: Attempt by Transaction[2:84] to modify historical revision:
> CDORevisionDelta[A@OID6578:0v543 --> [CDOFeatureDelta[a, SET, value=1, oldValue=UNSPECIFIED], CDOFeatureDelta[b, SET,
> value=2, oldValue=UNSPECIFIED], CDOFeatureDelta[x, SET, value=true, oldValue=UNSPECIFIED]]]
> at
> org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:77)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commitSynced(CDOTransactionImpl.java:1237)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1206)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1198)
> at testpackage.Class1.perform1(Class1.java:75)
> at testpackage.MyRunnable.run(MyRunnable.java:52)
> at java.lang.Thread.run(Unknown Source)
>
>
> I am a bit puzzled by this exception:
>
> 1. It is thrown before CDOMergingConflictResolver.resolveConflicts(Set<CDOObject> conflicts) is called
> 2. From the exception: "oldValue=UNSPECIFIED". The value should never be unspecified according to my code.
>
> Thanks for any help!


Re: [CDO] Multi-threaded access and CommitConflicts [message #1701170 is a reply to message #1701169] Thu, 09 July 2015 15:40 Go to previous messageGo to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
HI Eike,
thanks! This is good to know.
Re: [CDO] Multi-threaded access and CommitConflicts [message #1701975 is a reply to message #1701169] Fri, 17 July 2015 09:08 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6450
Registered: July 2009
Senior Member
Am 09.07.2015 um 17:30 schrieb Eike Stepper:
> Hi Alexander,
>
> I would try to use explicit locks on the objects that are changed with high frequency.
Please note that I've just fixed this bug, which is related to your scenario:

472924: Problems with explicit locking and high-frequency session open/close
https://bugs.eclipse.org/bugs/show_bug.cgi?id=472924

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Problem with SetCommand and unsettable Multi EReference
Next Topic:[CDO] lock(long timeout) not timeout-ing...
Goto Forum:
  


Current Time: Fri Nov 15 00:56:33 GMT 2019

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

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

Back to the top