Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Weird Issue with resources
[CDO] Weird Issue with resources [message #1843653] Thu, 12 August 2021 09:32 Go to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
Got into a weird problem that was traced to a small method refactoring that seems to just highlight a much deeper issue, maybe related to timing or something similar.

At play we have a persistent store and a MEM store. The MEM store specifically has a resource per project and also sibling resources for each user (i.e. project_userId in the resource path).

We noticed that in a MEM store object, we were loosing a reference to a persistent store object. Just before the commit we had:
CapabilityImpl{[cdoID->50cfd231-0ed8-11e5-acd8-9e3d3e95661e][ID->_UM_SMQ7YEeWs2J49PpVmHg]


then we saw that at commit time it got remapped to an external id and resulted in:
[oid:cdo://ba-10320-db/ProjectSpace#B50cfd231-0ed8-11e5-acd8-9e3d3e95661e]


and after that the object value was: [null] (many reference here with a value of null.

As stated above this was traced to adding some try/finally to make sure that values were always restored and to use a method instead of inline code to make our call to transaction.getOrCreateResource.

Also as we were investigating this and trying to tweak the code to understand where the issue came from, we started to get another exception from our persistent store resource locator. There we have getResource and in some cases do special things, but here we just delegated to basicGetResource and got some:
java.lang.IllegalStateException: Different object was registered for 9999b4a3-783d-4848-b081-819c0886e797
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerObject(AbstractCDOView.java:2621)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerProxyResource2(AbstractCDOView.java:2547)


I will note that all this code is called by many different threads, especially when a user logs in and even more so for the first user in a tenant, which also triggers the initialization of a number of tenant level sessions and various task handlers.

Hope I covered enough to elicit some ideas and can take it from there to the next step.

Thanks
Alain
Re: [CDO] Weird Issue with resources [message #1843679 is a reply to message #1843653] Fri, 13 August 2021 14:19 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Alain,

What version of CDO are you using? Is it possible that you provide a Junit test that, at least after a while, reproduces the problem?


Re: [CDO] Weird Issue with resources [message #1843718 is a reply to message #1843679] Sun, 15 August 2021 20:41 Go to previous messageGo to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
Using CDO 4.7

I wish I could find a way to have a unit test that can reproduce this. Actually looking maybe for a hint of what could cause this in order to put one together. But will try to tweak existing tests and see if I can create the many threads situation that seems to be at the source of the issue.
Re: [CDO] Weird Issue with resources [message #1843768 is a reply to message #1843718] Tue, 17 August 2021 09:15 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In addition to the self-evidently useful model loading functionality, EMF also provides significant complementary unloading functionality. For many users this is a major waste of time, but for other users it is an important source of bye bye notifications. Unloading of adapters is particularly troublesome and IIRC CDO takes extra precautions to ensure that this too happens consistently and expensively. In recent years EMF has improved to re-proxify references to unloaded models, which enables tools such as the Ecore Editor to refresh correctly after an independent edit/save.

Problems with proxies often appear to be problems with null references and since you have a diverse model/project/user context, unloading and 'null' proxies may be involved.

A JUnit test that emulates a typical usage lifecycle could be very revealing.

Of course EMF is fundamentally not thread-safe. It is entirely the responsibility of a multi-threaded application to ensure that all hazardous EMF calls are understood and appropriately synchronized. If your models are non-trivial, particularly if they use UML or OCL, understanding the hidden concurrences may be quite challenging, Similarly, co-existence with Papyrus or Xtext may require an understanding of their expectations.

Regards

Ed Willink
Re: [CDO] Weird Issue with resources [message #1844597 is a reply to message #1843768] Fri, 17 September 2021 08:53 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Without having a good clue about what you're trying to do or what's actually causing your trouble, here are a few ideas:

1) Try to upgrade to a more recent version of CDO as 4.7 is almost ten releases behind.
2) From your other post I see that you're using partial collection loading. It's just an optimization. Please try without that.
3) Are you trying to create references from one repo into another one? That should indeed involve CDOIDExternals.
4) I vaguely remember that a customer of mine had an issue with unexpected CDOIDExternal creations. That issue has been fixed a few years ago, see 1)


Previous Topic:Using Ecore2Java with dependent models
Next Topic:Getting CDOElementProxy in various places
Goto Forum:
  


Current Time: Fri Apr 26 00:18:57 GMT 2024

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

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

Back to the top