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 11:13  |
Eclipse User |
|
|
|
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 11:30   |
Eclipse User |
|
|
|
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!
|
|
| | |
Goto Forum:
Current Time: Wed Jul 23 05:06:28 EDT 2025
Powered by FUDForum. Page generated in 0.19959 seconds
|