Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceException
[CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceException [message #1252429] Fri, 21 February 2014 07:54 Go to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Hi!

Here is a code, which causes CDO to throw org.eclipse.emf.cdo.util.DanglingReferenceException (on second commit)

@Test
public void testNative() {
  CDOTransaction tx = memProject.openTransaction();
  CDOResource resource = tx.createResource("test_native.lifecycle");
  
  TransitionsType transitions = CycleFactory.eINSTANCE.createTransitionsType();
  transitions.getTransition().add(CycleFactory.eINSTANCE.createTransitionType());
  resource.getContents().add( transitions);
  
  try {
    tx.commit();
    transitions.getTransition().set(0, CycleFactory.eINSTANCE.createTransitionType());
    transitions.getTransition().set(0, CycleFactory.eINSTANCE.createTransitionType());
    tx.commit();
  } catch (Exception e) {
    e.printStackTrace();
    fail("There should be no exception!");
  } finally {
    tx.rollback();
    IOUtil.closeSilent(tx);
  }
}


The exception trace:

Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The object "TransitionType[TRANSIENT](ru.otr.sufd.document.lifecycle.impl.TransitionTypeImpl)" is not contained in a resource
  at org.eclipse.emf.internal.cdo.view.AbstractCDOView.provideCDOID(AbstractCDOView.java:1157)
  at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:2282)
  at org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:83)
  at org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:59)
  at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:501)
  at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.write(CDOListFeatureDeltaImpl.java:141)
  at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:501)
  at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.write(CDORevisionDeltaImpl.java:177)
  at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDORevisionDelta(CDODataOutputImpl.java:496)
  at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requestingCommit(CommitTransactionRequest.java:202)
  at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requesting(CommitTransactionRequest.java:128)
  at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientRequestWithMonitoring.requesting(CDOClientRequestWithMonitoring.java:91)
  at org.eclipse.net4j.signal.RequestWithMonitoring.requesting(RequestWithMonitoring.java:165)
  at org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedOutput(RequestWithConfirmation.java:119)
  at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
  at org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(RequestWithConfirmation.java:104)
  at org.eclipse.net4j.signal.RequestWithMonitoring.doExecute(RequestWithMonitoring.java:235)
  at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.java:53)
  at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
  at org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalProtocol.java:442)
  at org.eclipse.net4j.signal.RequestWithConfirmation.doSend(RequestWithConfirmation.java:89)
  at org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:75)
  at org.eclipse.net4j.signal.RequestWithMonitoring.send(RequestWithMonitoring.java:110)
  at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:518)
  at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.commitTransaction(CDOClientProtocol.java:393)
  at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:72)
  at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1191)


It reproduces both with legacy and native models with the same error and trace. Is it a but with CDO, or is it illegal pattern to use with cdo?

About model:
Transitions is really simple feature, just a basic containent reference with no opposite, nothing fancy.
Re: [CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceExcept [message #1262559 is a reply to message #1252429] Mon, 03 March 2014 19:24 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
As there is no reply for quite a long time, i'd like to bump this a bit.

To summarize, the question is - should CDO commit FeatureDelta's with SET type and TRANSIENT objects?

Sorry for any inconvenience this unnecessary bump has caused to anybody.
Re: [CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceExcept [message #1264731 is a reply to message #1252429] Wed, 05 March 2014 13:03 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 21-02-14 08:54, Leonid Ripeynih wrote:
> Hi!
>
> Here is a code, which causes CDO to throw
> org.eclipse.emf.cdo.util.DanglingReferenceException (on second commit)
>
Hi, is the feature 'transition.transitiontype' a containment reference?
If not, the created object 'TransitionType' should be added to the
CDOResource as well.

>
> @Test
> public void testNative() {
> CDOTransaction tx = memProject.openTransaction();
> CDOResource resource = tx.createResource("test_native.lifecycle");
>
> TransitionsType transitions =
> CycleFactory.eINSTANCE.createTransitionsType();
> transitions.getTransition().add(CycleFactory.eINSTANCE.createTransitionType());
> resource.getContents().add( transitions);
>
> try {
> tx.commit();
> transitions.getTransition().set(0,
> CycleFactory.eINSTANCE.createTransitionType());
> transitions.getTransition().set(0,
> CycleFactory.eINSTANCE.createTransitionType());
> tx.commit();
> } catch (Exception e) {
> e.printStackTrace();
> fail("There should be no exception!");
> } finally {
> tx.rollback();
> IOUtil.closeSilent(tx);
> }
> }
>
>
> The exception trace:
>
>
> Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The
> object
> "TransitionType[TRANSIENT](ru.otr.sufd.document.lifecycle.impl.TransitionTypeImpl)"
> is not contained in a resource
> at
> org.eclipse.emf.internal.cdo.view.AbstractCDOView.provideCDOID(AbstractCDOView.java:1157)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:2282)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:83)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:59)
>
> at
> org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:501)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.write(CDOListFeatureDeltaImpl.java:141)
>
> at
> org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:501)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.write(CDORevisionDeltaImpl.java:177)
>
> at
> org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDORevisionDelta(CDODataOutputImpl.java:496)
>
> at
> org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requestingCommit(CommitTransactionRequest.java:202)
>
> at
> org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requesting(CommitTransactionRequest.java:128)
>
> at
> org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientRequestWithMonitoring.requesting(CDOClientRequestWithMonitoring.java:91)
>
> at
> org.eclipse.net4j.signal.RequestWithMonitoring.requesting(RequestWithMonitoring.java:165)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedOutput(RequestWithConfirmation.java:119)
>
> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(RequestWithConfirmation.java:104)
>
> at
> org.eclipse.net4j.signal.RequestWithMonitoring.doExecute(RequestWithMonitoring.java:235)
>
> at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.java:53)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
> at
> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalProtocol.java:442)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(RequestWithConfirmation.java:89)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:75)
>
> at
> org.eclipse.net4j.signal.RequestWithMonitoring.send(RequestWithMonitoring.java:110)
>
> at
> org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:518)
>
> at
> org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.commitTransaction(CDOClientProtocol.java:393)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:72)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1191)
>
>
>
> It reproduces both with legacy and native models with the same error and
> trace. Is it a but with CDO, or is it illegal pattern to use with cdo?
>
> About model:
> Transitions is really simple feature, just a basic containent reference
> with no opposite, nothing fancy.
Re: [CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceExcept [message #1264896 is a reply to message #1264731] Wed, 05 March 2014 15:35 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Christophe Bouhier wrote on Wed, 05 March 2014 08:03

Hi, is the feature 'transition.transitiontype' a containment reference?
If not, the created object 'TransitionType' should be added to the
CDOResource as well.


Yes, it is containment.

[Updated on: Wed, 05 March 2014 15:36]

Report message to a moderator

Re: [CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceExcept [message #1265185 is a reply to message #1264896] Wed, 05 March 2014 19:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 05.03.2014 16:35, schrieb Leonid Ripeynih:
> Christophe Bouhier wrote on Wed, 05 March 2014 08:03
>> Hi, is the feature 'transition.transitiontype' a containment reference?
>> If not, the created object 'TransitionType' should be added to the CDOResource as well.
>
>
> Yes, they are.

I can reproduce this your problem. The trigger seems to be the second set(0, ...) call. Can youplease submit a bugzilla
so that I can fix it?

Cheers
/Eike

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


Re: [CDO] Setting list values by index twice causes org.eclipse.emf.cdo.util.DanglingReferenceExcept [message #1265209 is a reply to message #1265185] Wed, 05 March 2014 20:31 Go to previous message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Eike Stepper wrote on Wed, 05 March 2014 14:56

I can reproduce this your problem. The trigger seems to be the second set(0, ...) call. Can youplease submit a bugzilla
so that I can fix it?


Sure, here it is:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429709
Previous Topic:[XCORE] How to add an unique identifier
Next Topic:C# code generation from EMF
Goto Forum:
  


Current Time: Thu Apr 25 22:00:12 GMT 2024

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

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

Back to the top